![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
|
\ 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-
__________________
"die" he screamed at the polygon man. When he was done with him, only four points remained, a quad of what he once was. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Oct 2005
Posts: 68
Rep Power: 3
![]() |
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: \\ \" |
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
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!" print 'Another apostraphe: \' ... More text' |
|
|
|
|
|
#4 |
|
Programmer
|
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-
__________________
"die" he screamed at the polygon man. When he was done with him, only four points remained, a quad of what he once was. |
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Programmer
|
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?
-thondal-
__________________
"die" he screamed at the polygon man. When he was done with him, only four points remained, a quad of what he once was. |
|
|
|
|
|
#7 |
|
Programmer
|
Okay, so i just changed my keyboard layout to the us layout, and now i can use the \... hurray....
__________________
"die" he screamed at the polygon man. When he was done with him, only four points remained, a quad of what he once was. |
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
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.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#9 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
I believe OS X uses the forward slash character as the standard path delimiter, so perhaps a Norwegian Macbook keyboard doesn't bother with having an easy-to-find backslash, as presumably it's rarely used.
|
|
|
|
|
|
#10 |
|
Programmer
|
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-
__________________
"die" he screamed at the polygon man. When he was done with him, only four points remained, a quad of what he once was. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| about idle | demon101 | Python | 4 | May 23rd, 2006 10:18 PM |
| Python Idle will not start | zero771 | Python | 9 | Nov 27th, 2005 11:32 AM |