> Is input a Python function or command?
Its a function. You can tell because you need to use parens.
print, by contrast, is a command and doesn't need parens...
> I need to know because I'm planning to use it as
> a variable, and don't want to get an error.
Even if you don't want to use inpu
I'm cc'ing this back to the tutor list because others may spot things
I miss.
>K something must be wrong cause I typed python and it said "python is
>not
> defined" so any ideas
That means one of two things. Eother python is not installed yet,
or you have installed it but the path to Python is
On 7/31/05, Jorge Louis de Castro <[EMAIL PROTECTED]> wrote:
Hi,Thanks for your reply. I have been googling this issue and found thisarticle:http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable
that seems to indicate what I want is possible and it is available.
Hi,
I looked at th
Hi,
Thanks for your reply. I have been googling this issue and found this
article:
http://starship.python.net/crew/theller/moin.cgi/SingleFileExecutable
that seems to indicate what I want is possible and it is available. I
downloaded NSIS and compiled (did not choose the option to create an
i
Thanks Luke. Saved me quite a headache. I will use in_file instead. Makes
more sense anyway.
- Original Message -
From: "luke p" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>
Sent: Sunday, July 31, 2005 7:59 PM
Subject: Re: [Tutor] Is input a Python function or command?
why
Is input a Python function or command? I need to know because I'm planning
to use it as a variable, and don't want to get an error.
Thanks,
Nathan
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hey, looks like this is my problem. ) I'll just have to be more careful in
the future.
- Original Message -
From: "Alan G" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>;
Sent: Sunday, July 31, 2005 6:24 PM
Subject: Re: [Tutor] What's the invaild syntax? Error message and rel
> What the invalid syntax? Here is the error message:
> File "D:/Python22/grades.py", line 66
>which = which-1
> ^
>SyntaxError: invalid syntax
OK, so it tells you the syntax is wrong and the line it
detected the error. Try looking at a line or two
before it.
>while which
>> You might find the getpass module useful for that...
>> It provides a raw_input style prompt that doesn't
>> display what the user types...
> Does it display stars instead?
No, its more secure than that, it doesn't display anything.
But like anything in Python the esiest way to find out
is j
Does it display stars instead?
- Original Message -
From: "Alan G" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>; "Alberto Troiano"
<[EMAIL PROTECTED]>; "Danny Yoo" <[EMAIL PROTECTED]>; "luke"
<[EMAIL PROTECTED]>
Cc:
Sent: Sunday, July 31, 2005 5:45 PM
Subject: Re: [Tutor]
Thanks again Luke.
- Original Message -
From: "luke" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>;
Sent: Sunday, July 31, 2005 5:50 PM
Subject: Re: [Tutor] What's the invaild syntax? Error message and relative
codesupplied.
> NATHAN!
> you have had this exact same problem
Thanks Todd. Another one saved by you.
- Original Message -
From: <[EMAIL PROTECTED]>
To:
Sent: Sunday, July 31, 2005 5:56 PM
Subject: Re: [Tutor] What's the invaild syntax? Error message and
relativecode supplied.
>
> Remember this problem from yesterday?
>
> Take a look at the line b
Quoting Jorge Louis De Castro <[EMAIL PROTECTED]>:
> Hi all,
> I wrote a few small applications, couple hundred of lines each and one
> of them playing around with tkinter. Now py2exe leaves 10 or so files of
> all sorts and one executable to "distribute", and cx freeze isn't much
> better. Furth
Remember this problem from yesterday?
Take a look at the line before the one you are getting the error on.
And count the ('s and the )'s.
--Todd
On Sunday 31 July 2005 07:38 pm, Nathan Pinno wrote:
> What the invalid syntax? Here is the error message:
> SyntaxError: invalid syntax
> File "D
NATHAN!
you have had this exact same problem yesterday!
cmon man.
If you see an invalid syntax error,
look on the preceeding line.
it's usually caused by not enough parenthesis for your function call.
so we scroll down to lines 64-66...
>which = 1234
>while which != -1:
>
Hi all,
I wrote a few small applications, couple hundred of
lines each and one of them playing around with tkinter. Now py2exe leaves 10 or
so files of all sorts and one executable to "distribute", and cx freeze
isn't much better. Furthermore, my 15KB code becomes a whopping 8Meg
distributa
Hi all,
I wrote a few small applications, couple hundred of
lines each and one of them playing around with tkinter. Now py2exe leaves 10 or
so files of all sorts and one executable to "distribute", and cx freeze
isn't much better. Furthermore, my 15KB code becomes a whopping 8Meg
distributa
> baffling me. Now I'm first going to write the main part of a
> password
You might find the getpass module useful for that...
It provides a raw_input style prompt that doesn't
display what the user types...
HTH,
Alan G.
___
Tutor maillist - Tutor@
Hi all,
I wrote a few small applications, couple hundred of
lines each and one of them playing around with tkinter. Now py2exe leaves 10 or
so files of all sorts and one executable to "distribute", and cx freeze
isn't much better.
Isn't it possible to create a single, bundled
windows execut
What the invalid syntax? Here is the error message:
SyntaxError: invalid syntax File "D:/Python22/grades.py", line
66 which =
which-1 ^SyntaxError: invalid
syntax
Here is the code:
max_points = [25,25,50,25,100]assignments = ['hw ch 1','hw ch
2','quiz ','hw ch 3','test']stud
I am going to try and tackle the file I/O exercise in Non-Programmers
Tutorial For Python found at
http://www.honors.montana.edu/~jjc/easytyt/easytut/easytut.html. Should be a
fun task.
- Original Message -
From: <[EMAIL PROTECTED]>
To:
Sent: Sunday, July 31, 2005 4:32 PM
Subject: Re:
I fixed it. Here is the latest code:
filename = raw_input("File name please: ")
f = file(filename, "r")
for line in f.readlines():
print line
f.close()
Thanks for taking the time to explain the writing part, that was really
baffling me. Now I'm first going to write the main part of a password
Congratulations! So what are you going to try next?
--Todd
On Sunday 31 July 2005 06:27 pm, Nathan Pinno wrote:
> The Giant Calculator is perfect also!
> - Original Message -
> From: Nathan Pinno
> To: tutor@python.org
> Sent: Sunday, July 31, 2005 3:34 PM
> Subject: [Tutor] T
The Giant Calculator is perfect also!
- Original Message -
From:
Nathan
Pinno
To: tutor@python.org
Sent: Sunday, July 31, 2005 3:34 PM
Subject: [Tutor] Thanks to all!
Thank you to all. All my calculators run perfect. I can now make a
perfect Giant Calculator a
> file = raw_input("File name please: ")
> f = file(file, "r")
The problem is you used 'file' as a name. But file() is the function
to open a file. So in the second line you call your filename as
if it was a function!
Try using 'filename' for your variable instead. It's never a good
idea to us
>> Is there a 'substitute' function in python.
> You can do this with the translate() method of a string.
That was the clever stuff I was trying to remember, not a module
after all, a method!
Thanks Kent,
Alan G.
___
Tutor maillist - Tutor@python.
> Is there a 'substitute' function in python.
Assuming we are dealing with strings then there are two.
The string objects provide a replace() method and the
regulatr expression module re provides substitute.
> I want to substitute A with T and G with C and vice
> versa
>
> A -> T
> G -> C
> T -
Nathan,
I saw in your previous example that you called
#quote
file = raw_input("File name please: ")
f = file(file, "r")
for line in f.readlines():
print line
f.close()
#endquote
the reason you were getting an error is that
you made a variable named "file" on line one,
which then overwrote th
Thank you to all. All my calculators run perfect. I can now make a perfect
Giant Calculator as well.
Thanks again,
Nathan
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Okay I understand how to open and read to a file, but how do I write to a
file, e.g. a list.
- Original Message -
From: "Nathan Pinno" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>; "Danny Yoo"
<[EMAIL PROTECTED]>
Cc:
Sent: Sunday, July 31, 2005 2:46 PM
Subject: Re: [Tutor]
Here's the improved version.
file = raw_input("File name please: ")
f = open(file)
for line in f.readlines():
print line
f.close()
- Original Message -
From: "Nathan Pinno" <[EMAIL PROTECTED]>
To: "Danny Yoo" <[EMAIL PROTECTED]>
Cc:
Sent: Sunday, July 31, 2005 2:29 PM
Subject: Re: [T
Just ran the code and got the following error:
File name please: news.text
Traceback (most recent call last):
File "D:\Python22\filewriter.py", line 2, in ?
f = file(file, "r")
TypeError: 'str' object is not callable
Why isn't it callable? Help me understand.
- Original Message -
Fr
Here's my work. I call it filewriter.
The code:
file = raw_input("File name please: ")
f = file(file, "r")
for line in f.readlines():
print line
f.close()
Will it do the trick?
Nathan
- Original Message -
From: "Danny Yoo" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>
Cc
yes luke.
I could you biopython, but i am giving a shot to
bypass it and write my own.
thank you kent for your reply.
srini
--- luke <[EMAIL PROTECTED]> wrote:
> Are you making a biology program Srinivas?
>
> - Original Message -
> From: "Kent Johnson" <[EMAIL PROTECTED]>
> Cc:
> Sen
Are you making a biology program Srinivas?
- Original Message -
From: "Kent Johnson" <[EMAIL PROTECTED]>
Cc:
Sent: Sunday, July 31, 2005 2:46 PM
Subject: Re: [Tutor] substitute function
> Srinivas Iyyer wrote:
> > Hello group:
> >
> > Is there a 'substitute' function in python.
> >
> >
Srinivas Iyyer wrote:
> Hello group:
>
> Is there a 'substitute' function in python.
>
> For example:
> I want to substitute A with T and G with C and vice
> versa
>
> A -> T
> G -> C
> T -> A
> c -> G
You can do this with the translate() method of a string. It is a two-step
process. First you
I'd post another code, but I've already figured it out, thanks to help on
the mini calc program.
- Original Message -
From: "Alan G" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]>;
Sent: Sunday, July 31, 2005 2:03 AM
Subject: Re: [Tutor] How do I make a Python program keep re
Hello group:
Is there a 'substitute' function in python.
For example:
I want to substitute A with T and G with C and vice
versa
A -> T
G -> C
T -> A
c -> G
thanks
Start your day with Yahoo! - make it your home page
http://
http://uselesspython.com/tutorials/PythonFileIOStepByStep.pdf
I've written a quick step-by-step .pdf to walk through the process of
creating a new text file, read from it, and append to it with Python.
It doesn't cover every last thing one can do with opened files, but
does point to a few other re
Tom Cloyd wrote:
> I'm working on a WinXP SP-2 OS.
>
> I'm too ill-informed to figure this out: When I execute
>
> C:\Python24\python.exe
>
> I get
>
> 'import site' failed.; use -v for traceback
> ActivePython 2.4.1 Build 247 ...
>
>
> I then ran this from a DOS window, and tried to redirect
Reed L. O'Brien wrote:
> This is a little long
> a program consisting of
> bsserver.py ## to define server class and methods
> bscaller.py ## to define a test class subclasses for services (imap
> http pop dns et al)
> bslogger.py ## to log and analyze tests and send emails on
> exceptions/fail
Joseph Quigley wrote:
> I have no idea how to get the server to receive and print a message or
> for the client to send the message. Does anyone know of some good python
> networking tutorials designed for newbies? (Not ones on
> www.awaretek.com. They seem to expect you to know some things that
Miguel,
I've never heard of JBUS but if its an RS232 protocol then it is
possible
to get Python to talk to RS232 posts using various 'serial' comms
modules.
Its not the easiest thing in the world but itss definitely possible.
HTH,
Alan G.
- Original Message -
From: "Miguel Lopes" <[
> first I would like for this instance to be named the name of the
> host in
> the section but i keep getting instances named section
This is a common beginners question but its nearly always the wrong
thing to do. For a start how would the rest of your program know about
these new instance names
> it said this is for newbies but I download the 2.4 and I tried the
> stuff it
> said on the tutorial like the control-z or sys.exit () I tried the
> control-p
> or the python -c but it always says "'something' is not defined" or
> " invalid
> syntax" where do I go or what do I do. do i go th
> If anyone will help me learn file I/O, it would be appreciated.
> I went through Josh Cogliani's Non-Programmer's Tutorial for Python,
> and I still can't understand it.
What exactly don't you understand?
Try the file handling topic in my tutor. see if thats any clearer?
It covers opening, read
> while cal_opt != 9:
>menu()
>cal_opt = cal()
>if cal_opt == 1:
>elif cal_opt == 2:
...
>elif cal_opt == 7:
>else:
>print "That's not an option. Try again."
>menu()
>cal()
Because you don't have a specific check for the exit value (9) the
else part
> How do I make a program keep repeating until the user is done with
> it?
The math shapes example you just sent in with a syntax area does just
that.
What else do you need?
Alan g
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
> option = int(raw_input('Option (1,2,3,4,5,6,9): ')
Count the parentheses, there's one missing!
Alan G.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
HI Tom,
This message answers a couple of questions but not the one you
really need - whats going wrong?!
> I then ran this from a DOS window, and tried to redirect the -v
> output to a text file, so I could include it, but nothing I did was
> successful. I can't imagine why the output wouldn'
50 matches
Mail list logo