![]() |
\ in idle?
trying to write some python on my macbook, but when in idle I cannot make the \. Why? Everywhere else it works. Just not in idle, I can make every other characters even the /, but just not \. Can somebody help me please? Using macbook intel with OS 10.4.9 if that helps you in helping me.
-thondal- |
i'm a n00b programmer, but i'll try to answer anyway.
Are you trying to print out \ ? Probably need an escape sequence to print it out, e.g: \\ \" |
Yes, Python, like almost all other languages, reserves the "\" character for identifying escape sequences. If you want to output a newline you print "\n", a tab is "\t", an alert is "\a", etc, etc...
You can get a complete list on all of the different escape sequences. To output a slash, you can write, as kurt mentioned: :
print "This is one slash: \\ ... \nThis is two slashes: \\\\"Escape sequences can also be used to output an apostraphe without closing your print statement: :
print "Look! An apostraphe: \" ... And yet this is still printed out!" |
no.... i meant just the \.. at all in idle.. i canīt write it at all.. is this a common problem in idle..
I know enough python to know how to print it out.. problem is, i canīt write it at all when iīm in idle.. i can when i write it in word, and other places, like here.. i know it is the alt+command 7, but it wonīt show when I try to write it... -thondal- |
Hmmm. Are you saying there's not a key for it on your particular keyboard, and that a sequence that normally generates it is not being interpreted properly by Idle?
|
well.. on my norwegian keyboard there is only one way to get it, and that is to do command+shift 7... but where is that button on the ameriac/us/english layout? because if there is a button for it there, then i could just change over to that kind of layout and write code.. got a picture of one? :D
-thondal- |
Okay, so i just changed my keyboard layout to the us layout, and now i can use the \... hurray....
|
Great. Incidentally, on a typical US keyboard the '\' is right below the backspace key. I'm mildly surprised that there isn't a dedicated key for it, given its common usage as a path delimiter, as well as (for programming-type users) an escape character.
|
Quote:
|
well, i found it rather difficult to program in python(idle) when i have to use us layout, because i have no idea where the " are, and all the other stuff, it kinda gets upside down. So, think I have to find a norwegian forum for this one. Sorry to bother you guys, and Dawei, thanks for the quick reply.
-thondal- |
| All times are GMT -5. The time now is 11:18 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC