Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 20th, 2007, 10:14 AM   #1
thondal
Programmer
 
thondal's Avatar
 
Join Date: Jan 2006
Location: Norway
Posts: 82
Rep Power: 3 thondal is on a distinguished road
Send a message via MSN to thondal
\ 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.
thondal is offline   Reply With Quote
Old Mar 20th, 2007, 10:26 AM   #2
kurt
Programmer
 
Join Date: Oct 2005
Posts: 68
Rep Power: 3 kurt is on a distinguished road
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:
\\
\"
kurt is offline   Reply With Quote
Old Mar 20th, 2007, 12:46 PM   #3
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,885
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
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'
Sane is offline   Reply With Quote
Old Mar 22nd, 2007, 9:11 AM   #4
thondal
Programmer
 
thondal's Avatar
 
Join Date: Jan 2006
Location: Norway
Posts: 82
Rep Power: 3 thondal is on a distinguished road
Send a message via MSN to thondal
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.
thondal is offline   Reply With Quote
Old Mar 22nd, 2007, 9:16 AM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Mar 22nd, 2007, 9:23 AM   #6
thondal
Programmer
 
thondal's Avatar
 
Join Date: Jan 2006
Location: Norway
Posts: 82
Rep Power: 3 thondal is on a distinguished road
Send a message via MSN to thondal
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.
thondal is offline   Reply With Quote
Old Mar 22nd, 2007, 9:42 AM   #7
thondal
Programmer
 
thondal's Avatar
 
Join Date: Jan 2006
Location: Norway
Posts: 82
Rep Power: 3 thondal is on a distinguished road
Send a message via MSN to thondal
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.
thondal is offline   Reply With Quote
Old Mar 22nd, 2007, 10:02 AM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Mar 22nd, 2007, 10:45 AM   #9
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by DaWei View Post
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.
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.
Arevos is offline   Reply With Quote
Old Mar 23rd, 2007, 7:26 PM   #10
thondal
Programmer
 
thondal's Avatar
 
Join Date: Jan 2006
Location: Norway
Posts: 82
Rep Power: 3 thondal is on a distinguished road
Send a message via MSN to thondal
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.
thondal is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:40 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC