Backslash, where is it?

Soldato
Joined
27 Mar 2016
Posts
7,442
Location
Bristolian living in Swindon
Hi all

So I'm learning python and getting to grips with Variables, functions etc but one thing I'm not able to do is the \n command for new line....

I can't find Backslash on my keyboard anywhere and tried all the recommendations on Google but nothing seems to work :cry:

Is there an alternative command or does anyone know where my \ is hiding please
 
Think the only other way in python to put strings on a new line without using \n is to do a separate Print() for each line.

print ('Line 1')
print ('Line 2')

as appose to print ('Line 1 \nLine2')
 
seems to be between left shift and Z, directly above the windows key
\\\\\\\\


Have you one of those weird 60% keyboards or something rather thana full size
 
seems to be between left shift and Z, directly above the windows key
\\\\\\\\


Have you one of those weird 60% keyboards or something rather thana full size

Nooooo full size one bud, will get the missus to try that left shift and Z and let me know as I'm at work... Hopefully it's alright.

@Minibiker - a picture of your actual keyboard, and what Windows keyboard layout you are using may be helpful

I will get one uploaded later if the above doesn't work bud, it's an old keyboard but full size, I don't even know the model I got it for £10 off a friend :cry:
 
Think the only other way in python to put strings on a new line without using \n is to do a separate Print() for each line.

print ('Line 1')
print ('Line 2')

as appose to print ('Line 1 \nLine2')

Basically what I'm trying to do is create a 'shop keeper' and when it offers the products I want them to move to the next line

Print ("what would you like from our menu? \n" + menu)

Something like that


Were you using the onscreen keyboard for inserting those backslashes.

No all on keyboard, didn't know there was a onscreen keyboard
 
Nooooo full size one bud, will get the missus to try that left shift and Z and let me know as I'm at work... Hopefully it's alright.



I will get one uploaded later if the above doesn't work bud, it's an old keyboard but full size, I don't even know the model I got it for £10 off a friend :cry:
It largely depends on whether it's an ISO or ANSI keyboard, and whether the Windows keymap is set to match the printed legends e.g. UK vs US.

If it's UK ISO (Enter key is like an L shape tetris piece) - it "should" be between left shift and Z.
If it's UK ANSI (Enter key is straight), then it should be between backspace and Enter
 
Basically what I'm trying to do is create a 'shop keeper' and when it offers the products I want them to move to the next line

Print ("what would you like from our menu?" + menu)

Something like that




No all on keyboard, didn't know there was a onscreen keyboard
menu = {'Apple':1.99,'Beer':3.99,'Bread':0.50}
print('What would you like from our menu ?\n',(menu))

or like this ?

print('What would you like from our menu ?')
print(menu)

I'm no python guru, currently learning this myself :D
 
menu = {'Apple':1.99,'Beer':3.99,'Bread':0.50}
print('What would you like from our menu ?\n',(menu))

or like this ?

print('What would you like from our menu ?')
print(menu)

I'm no python guru, currently learning this myself :D

Basically like your first print function bud, instead of () around the menu I'd use + menu.... Its known as a concatenate, to add multiple strings together
 
Just so happens I have both ISO and ANSI layout boards on my desk, so I can show you. A very quick way to test that you have the correct keymap set for your board layout is to press shift+3 if you get a # symbol it's ANSI if you get a £ it's ISO
Photo Blackslash \ is circled on each board and labelled.

Sorry about all the dust on the lower one, didn't realise it was so bad until I looked at the photo, I took all the keycaps off and cleaned it only about a month ago.
 
Not the best quality pic for you all to have a look at but this is the keyboard I'm using for now, it's an old model but I can only see one backslash above tab but it doesn't work no matter what I pair with it (Shift, ALT etc)

 
What keyboard layout does Windows say you are using? What happens if you press Shift+3 for a pound sign etc.


Easy but not correct fix, would be to download Powertoys and use the Remap keys feature:

jwIVocU.png
 
Not the best quality pic for you all to have a look at but this is the keyboard I'm using for now, it's an old model but I can only see one backslash above tab but it doesn't work no matter what I pair with it (Shift, ALT etc)

Try the FN key on the bottom row on the right hand side?

Also that KB is all sorts of weird. UK layout but no £ on 3, no “ on 2, I’d just buy a new KB!
 
Try the FN key on the bottom row on the right hand side?

Also that KB is all sorts of weird. UK layout but no £ on 3, no “ on 2, I’d just buy a new KB!

Will give that ago thank you... Yeah I will be buying a new one next Monday (payday) this is a piece of **** :cry:
 
That's a really odd keyboard, it is an ISO layout, you have the large enter key but you also have 2 full length shift keys and no pound symbol on the 3 key, so it's not a UK layout ISO either ...weird.
 
Back
Top Bottom