ChiPy, is going to have a speaker on Jython this Thursday, January 13th.
For more information, check out the group site at:
http://www.chipy.org
Everyone is welcome, benginner to advanced. We love all kinds of input.
You'd be surprised what you can learn when you get the chance to
actually
The best one I've
You might want to check out sqlobject, too
http://sqlobject.org/
It gives you a relatively simple way to "objectify" SQL statements.
--
David Rock
[EMAIL PROTECTED]
pgpRBRwPdqdc0.pgp
Description: PGP signature
___
know ;-)
Still, I can't help wishing I had a simple way to create a dict from a
DOM. From a Python perspective, that seems more "Pythonic" to me as
well. I guess it's just a different way of looking at it.
--
David Rock
[EMAIL PROTECTED]
pgpq4Ua00eRSO.pgp
Description: PGP signa
* Max Noel <[EMAIL PROTECTED]> [2005-01-19 11:48]:
>
> On Jan 19, 2005, at 03:58, David Rock wrote:
>
> >For me, it seems that the way you are supposed to interact with an XML
> >DOM is to already know what you are looking for, and in theory, you
> >_should
this means. Thanks again.
It means it didn't find anything that matches that pattern, which
suggests that the directory does not contain *.py files. That might be a
problem. ;-)
--
David Rock
[EMAIL PROTECTED]
pgpmTRknYUp8c.pgp
Description: PGP signature
roach to this, I like to use the fileinput module. In the
case of the original example of mimicing grep, it allows you to easily
handle both a list of files passed to the command or use it as a pipe.
The default action if there are no files given is to use stdin.
http://www.python.org/doc/2.4/l
s anyone know why this try block doesn't catch the exception? The
version of Python I am using is 2.3.3
Thanks.
--
David Rock
[EMAIL PROTECTED]
pgprCjzYhfyU7.pgp
Description: PGP signature
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
* Kent Johnson <[EMAIL PROTECTED]> [2005-04-07 15:28]:
> David Rock wrote:
> >I am trying to catch an exception from the csv module but it doesn't
> >seem to be generating a proper exception because I don't seem to be able
> >to catch it. Here is what I
* David Rock <[EMAIL PROTECTED]> [2005-04-07 15:00]:
> * Kent Johnson <[EMAIL PROTECTED]> [2005-04-07 15:28]:
> > David Rock wrote:
> > >I am trying to catch an exception from the csv module but it doesn't
> > >seem to be generating a proper exception b
opt http://docs.python.org/lib/module-getopt.html
Long options on the command line can be recognized so long as they
provide a prefix of the option name that matches exactly one of the
accepted options. For example, if long_options is ['foo', 'frob'], the
s is not supported yet, you would
probably have to reopen the tarfile, write it to a new one file-by-file,
excluding the ones you don't want. Messy :-(
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
are trying to
accomplish. Can you supply an example of an "extensible application"
and also a longer description of what you mean when you say "plugin."
Perhaps some links to what you have looked at so far would also help to
clarify?
--
David Rock
[EMAIL PROTECTED]
is the expected behaviour, per the documentation:
http://docs.python.org/lib/built-in-funcs.html#l2h-58
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
n" in the kernel? This would
potentially be something that could happen with ANY lniux system, not
just gentoo.
FWIW, I am having the same problem (even though I never actually tried
on this system before) :-)
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
that off. I did want it more secure :-)
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
processing. It also give me
the flexibility of using it as a pipe OR assigning a wordlist of files
to the script instead.
http://www.python.org/doc/2.4.1/lib/module-fileinput.html
import fileinput
for line in fileinput.input():
process(line)
--
David Rock
[EMAIL P
ere that would undoubtedly perform much better than a
PythonOS ever could. That doesn't mean it wouldn't be cool, though. :-)
--
David Rock
[EMAIL PROTECTED]
pgpbDnlqYILFN.pgp
Description: PGP signature
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
0: 2321 202f 7573 722f 6269 6e2f 7079 7468 #! /usr/bin/pyth
010: 6f6e 0a70 7269 6e74 2022 4865 6c6c 6f22 on.print "Hello"
020: 0a .
Bottom line, the error means bash can not find the application you told
it to use, so somethin
s:
import zipfile
try:
ziparchive = zipfile.ZipFile(inputfilename, "r")
except:
print "error accessing file"
You could get fancy and deal with various exceptions or read traceback
info, too. Using the try block is generally considered
generally try to stay away from doing the work for you :-)
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
se. I am trying to upload the first line in the
> file to get myself started. The code is below:-
You may want to check out the csv module to aid in any odd data input,
too.
http://docs.python.org/lib/module-csv.html
--
David Rock
[EMAIL PROTECTED]
___
I don't know if its still around or if it runs on modern
> > PDAs - I think it was PalmOS anyhow...
> >
> >
>
> Pippy is quite dead. No development done recently. It supposedly runs
> fine, but runs only Python 1.5.
La
is similar to chomp
http://docs.python.org/lib/string-methods.html#l2h-201
These aren't exact matches, but they are close.
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ut found nothing suitable
os.getcwd()
http://docs.python.org/lib/os-file-dir.html
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
x27;
What you will notice is it gets complicated in a hurry if you try to do
loops or anything fancy because of formatting constraints. Not that it
can't be done, but it would hurt to try. :-)
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist
simple in a
shell script and didn't have a good way to get the date info I wanted,
so I started playing around with python -e. It really SHOULD just be a
python script that calls shell stuff, not the other way 'round :-)
Still, in the spirit of the OP, I thought it would be approp
what you expect to see
from them, then the
for o, a in opts:
section is used to replace default values with information from the
commandline.
--
David Rock
[EMAIL PROTECTED]
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
hon user group)
http://www.chipy.org meeting a few months ago. He's a great guy and he
did some pretty impressive things with it. It also appears to interact
well with ipython, an extremely powerful python interpreter shell (much
better than the built-in shell) http://ipython.scipy.org/
--
Da
dy be in your path, so typing "python" at the propmt should
result in it running the interpreter. If that works, exit the
interpreter and type "python scriptname" That should run your script,
and you will see the results in the command window because it won't
close afte
e block, the value in your largest current value will actually be
the largest palindrome.
--
David Rock
da...@graniteweb.com
pgpqe98kqh5z1.pgp
Description: PGP signature
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
e that gets generated
automatically and is the code that is actually executed.
Somehow, calling the method test inside the interpreter is different
from running it on the commandline and you are picking up the pyc file.
In either case, this format is iffy at best:
if __name__ ==
stems,
will be using methods that might be OS-specific (os.fork() comes to
mind).
As long as you keep things neutral, you shouldn't have huge issues.
--
David Rock
da...@graniteweb.com
pgpOARLwWTZLn.pgp
Description: PGP signature
___
Tutor mail
ing data because it
doesn't have to be the same data type. You can nest variables, lists,
dicts, etc all at the same level:
dict = {}
dict['mylist'] = [1,2,3]
dict['mystring'] = 'string'
dict['mynum'] = 4
dict['anotherdict'] = {}
dict['anotherdict']['anotherstring'] = 'string2'
--
David Rock
da...@graniteweb.com
pgp8ik0yrru5G.pgp
Description: PGP signature
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
herhash'} = {};
> $hash{'anotherhash'}{'anotherstring'} = 'string2';
>
> Thomas
Hah. Fair enough :-)
--
David Rock
da...@graniteweb.com
pgpszglXkVXly.pgp
Description: PGP signature
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
hich
case, you can try to resolve the two lines, or fail out if the criteria
isn't met.
Essentially, your problem isn't with using fileinput, it's with how you
handle each line that comes in.
--
David Rock
da...@graniteweb.com
pgpsm5eZpm6mp.pgp
Description: PGP signature
_
part, you have already answered your own question.
Specifically, you get your input file, FinalProjectBill.txt, by
collecting data from the user, doing some calculations, and outputting
to the file.
I'm not sure I see the problem. :-(
--
David Rock
da...@graniteweb.com
pgp
ironment to use.
I think we would need to better understand exactly what you are trying
to build, but you are probably looking for something that would be a
much lower level than python.
--
David Rock
da...@graniteweb.com
pgp7NxdORAGka.pgp
Description: PGP signature
___
be able to differentiate.
module1.DbPath() is not the same thing as module2.DbPath()
Your functions.DbPath() is the way to go.
--
David Rock
da...@graniteweb.com
pgpstgBsNVZmH.pgp
Description: PGP signature
___
Tutor maillist - Tutor@python.org
T
; development boat.
>
> So starting from scratch, how-to?
Coming here is a good start. Welcome!
Start here for beginning ideas:
http://wiki.python.org/moin/BeginnersGuide
You will find a number of good jumping-off points under the "Learning
Python" section.
Come back as you
s they don't exist
in the namespace, but test() knows about them. You are reading too much
into the comment that the module is "deleted".
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
can use on a commandline, options
and arguments. Options are the switches that change the program's
behavior and arguments are the inputs to the program (filenames, etc).
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
something like:
text = raw_input("Enter text: ")
sep = 'and'
parts = text.split(sep)
for i in parts[:-1]:
print i
print sep
print [-1]
You might also want to consider stripping whitespace in the individual
list items, too.
--
David Rock
da...@graniteweb.com
__
* David Rock [2012-08-23 15:03]:
> * Jared Nielsen [2012-08-23 12:05]:
> > Hi all,
> > I'm new to programming and Python.
> > I want to write a script that takes a string input and breaks the string at
> > keywords then outputs the pieces on separate lines.
>
rn (parts[0],)
else:
return parts[:-1] + repart(parts[-1])
if __name__ == '__main__':
text = "Ham and cheese omelette with hasbrowns and coffee."
parts = repart(text)
for part in parts:
print part.strip() # Clean up whitespace w
ile reader, plus a host of other useful methods for
info about the file you are reading.
Part of what you really need to define is the context of your question
of "better." What is your use case? From where is your list of files
coming? Is it truly just "read and forget"? Your
p as well.
set softtabstop=4
It's very handy for allowing the delete key to go back TAB number of
spaces (ie, deletes those 4 spaces you just inserted).
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To u
* Alex Kleider [2015-08-10 11:26]:
> On 2015-08-10 08:33, David Rock wrote:
>
> > You might want to add softtabstop as well.
> > set softtabstop=4
> >
> > It's very handy for allowing the delete key to go back TAB number of
> > spaces (ie, deletes thos
ay to break
out of your logic when the next mpath is seen.
You will also want to think about what to do with all your LUNs. You
have four per mpath, not one. Do you want to capture only one, or do
you need all of them?
--
David Rock
da...@graniteweb.com
path"
2. looking up by value would work, but maybe you should do it the other
direction. Your SCSI values will be unique, so use that as the key
a "simpler" logic is probably:
a) read file
b) store the LUN value from your mpath line
c) iterate over lines and find SCSI key, then
comeEvent(handled=False, test=,
> result=, outcome='error', exc_info=(, TypeError('this constructor takes no
> arguments',), ), reason=None, expected=False, shortLabel=None,
> longLabel=None) is not JSON serializable
This doesn't appear to be all of your code. What
vironment but the OP
> specifically mentioned writing longer programs and editing
> files which is not what IPython does best. I suspect that's
> why it didn't get a mention earlier.
Very likely, but it's definitely worth mentioning as a runtime environmen
SCII
> terminals? ~(:>)
I'm using mutt in a screen session on raspbian. Looks fine to me.
I have put a lot of effort into "properly" displaying "weird" things, though.
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
oes something for you, it will be more satisfying and
more likely to stick in your brain.
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
herry-pick
packages from testing; that’s a little advanced (but something to keep in mind).
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
t be. The easiest thing to do
is google for your distro name and the brand of device and see if there are any
issues.
If you follow my earlier advice on trying a liveCD of your chosen distro first,
that will give you a really good idea if your hardware will work.
—
Davi
is more important), try
out Mint. You may or may not like it, but you won’t know until you try. I
still say a dry run in a VM to get a feel for it would do wonders for you
regardless.
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tuto
ard do you have? Most Corsairs have a “BIOS switch” for exactly
this issue.
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
> On Jun 29, 2016, at 12:32, boB Stepp wrote:
>
> On Wed, Jun 29, 2016 at 12:02 PM, David Rock wrote:
>>
>>> On Jun 29, 2016, at 11:20, boB Stepp wrote:
>>>
>>> My Christmas present of a Corsair mechanical gaming keyboard was not
>>> _seen
say yes.
It adds a layer of flexibility with you disk layout that you will be sad you
don’t have later.
> Thanks for all of the help even though this has been off-topic for this list!
>
> Meanwhile, more playing around with Mint!!
have fun!
—
David Rock
da...@graniteweb.com
-many packages depending on the complexity. All
you need to worry about is the thing you want, and let the system do the rest.
:-)
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription o
al sequences in the documentation). For example,
\s means any whitespace character, \w means any alphanumeric or underscore, \d
means any digit, etc.
You can look them up in the docs:
https://docs.python.org/2/library/re.html
—
David Rock
da...@graniteweb.com
___
r stops is
because this test is never true:
>if len(response.json()["files"]) == 0:
>break
Since you are downloading and not removing anything, there’s always going to be
files so you will never break out of the while loop.
I think you need to get the lis
e thing, please)? Where does it say the syntax error is?
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
; it’s still trying to read
everything until it times out.
either add a short timeout value to your telnetlib.Telnet(), or try a different
read method; for example, read_very_eager
you could also try using telnetlib.set_debuglevel() to try and get more details
about what’s actually
> On Sep 24, 2016, at 15:49, Phil wrote:
>
> On 25/09/16 01:01, David Rock wrote:
>>
>> when you say "the client is not responding, certainly not as expected”,
>> what, exactly, is the output you get?
>>
>
> In my dazed state I think I responde
> On Sep 24, 2016, at 18:59, Phil wrote:
>
> On 25/09/16 07:17, David Rock wrote:
>> header = tn.read_until("character is '^]’.”, timeout=5)
>> print(header)
>
> Thank you David, read_until() led me to a result. It seems that the telnetlib
> doesn'
in f1:
if between [x02] and [x03]:
output =+ line.strip()
else:
f2.write(output)
output = ""
Basically, you need to loop over everything between your markers and put
them in a single entry, then send that one entry all
stx and etx (comment lines, other data that you
don't want), then it gets a lot harder.
If you don't have at least a marginally consistent input, your only real
option is probably going to be scanning by character and looking for the
\x02 and \x03 to get a glob of data, then parse that glob
ter).
That would artificially create "record" data that you could manipulate
and combine partial segments into complete xml records to parse. Might
be faster, might not, probably would get complicated pretty quickly but
could be an option.
Without seeing actual data, it's tough to spec
ml doesn't care about layout and whitespace etc.
>
> Which xml parser are you using - I assume you are not trying
> to parse it manually using regex or string methjods - that's
> rarely a good idea for xml.
Yeah, since everything appears to be .., the "event" flags
of [\
while loop is testing for r, p, and s to all be equal to each other and
set, which is not what you want to test.
Basically, your while loop is immediately false as soon as you run your script.
You need to rework your logic to test the player’s value.
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
e a specific order by design so will always be in
the order they were created.
What are you trying to do with join() on a dictionary in the first place? Is
there a specific outcome you are trying to get? It’s unlikely that using join
on a dictionary is what you actually want.
—
David Rock
da...@g
e he wasn't looking, and
> sneaked in some commas and spaces ;)
>
> That's cheating...
yeah, just a little. :-)
You can use join for this:
suitcase = ["book", "towel", "shirt", "pants"]
output = ', '.join(suitcase)
print ("You
yours: You have a book, towel, shirt, pants, in your luggage.
String concatenation with a loop is notorious for adding extra stuff at the
end. To get it right, you have to take into account what to do at the end of
the list, which adds code complexity.
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
th a couple auto-commands on connect, but that's not the same thing.
If it's a long string of commands, you might be better to pscp a shell
script to the target with one command, and then call that script with
the putty profile.
I would research automating putty first, then see if there
d to do is figure out how to use a
loop (eg, while loop, for loop). I would recommend thinking about some
pseudocode to determine your program's flow and then try to build
something to accomplish that.
--
David Rock
da...@graniteweb.com
___
Tutor m
al prompt.
Verified on 10.6.8
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
oogling for "cocoa emacs" returns:
http://emacsformacosx.com/
Perhaps that will work for you. I've tested that it works on my system,
at least ("works" = it ran).
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
x27;)
>>> data
['French']
Then just put the list as the value.
d['characteristics'] = data
>>> data = 'Canadian, Pub Food'.split(',')
>>> d['characteristics'] = data
>>> d['characteristics']
['Canadian', ' Pub Food']
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
So it's really more about personal taste than anything. If you _like_
what you are using, that's fine. I wouldn't like that setup.
All options are valid options. Try them all and find what you like.
--
David Rock
da...@graniteweb.com
_
* Steven D'Aprano [2013-05-09 10:29]:
> On 09/05/13 02:57, David Rock wrote:
> >
> > Well, not to start a flame war, but that is all subjective.
>
> Did I say otherwise? I was very careful to say "more natural FOR ME,
> faster FOR ME".
Not at all, but it w
ich
again, works well, but is not necessarily intuitive.
> Or use emacs... :-)
There's always one. You aren't helping the case for console apps with
that one at all. :-)
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@p
moment.
Yes, the disconnect/reconnect is nice (I use it a lot). It's not exactly
relevant to merits of console interfaces vs GUI, though. That's more of
a "this is a cool baked-in capability for working with lousy network
connections", which you can also do with things like V
* Alan Gauld [2013-05-09 16:50]:
> On 09/05/13 15:42, David Rock wrote:
>
> >> Or use emacs... :-)
> >
> > There's always one. You aren't helping the case for console apps with
> > that one at all. :-)
>
> But then emacs can also be considered
thought str() would do it but it didn't. Reading about str() it talks of
> string representation. So how can I convert it to a true string I can
> slice and build my date look a like?
Is there a requirement to store them as numbers in the first place? Why
not just store them as a st
:
INUSE field may be empty, so you will grab the wrong value
1700 might be somewhere other than where you expect it
etc
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mai
ne 1, in
IndexError: string index out of range
>>>
Can you be a little clearer what you need? Are you looking to store
them in variables, an array, print them? If printing them, are you
looking to output one per line, or spaced out?
--
David Rock
da...@graniteweb.com
he merits of
one place over the other, just that simple organization is a good thing.
Put it wherever you want, but at least keep it organized. Dropping
everything in Desktop is not organized.
--
David Rock
da...@graniteweb.com
___
Tutor maill
So, instead of
while n <= 10:
Think about:
while something <= n:
and changing something and retesting.
--
David Rock
da...@graniteweb.com
__
#x27;, 'ignore').strip()] is
an O(N**2)?
2. How do you know that fullPath.append(line.decode('utf-8', 'ignore').strip())
is not?
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ch would be to change the command you are running. I've
never heard of hamachi list before; does it have any commandline options
to display only IP addresses?
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
nput(). A single file name
is also allowed."
It gives a fairly clean way to just "do the Right Thing" whether you are
feeding files, or reading from stdin.
--
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
ollow what you expect the output to be, though.
What do you want the results of running the script to look like?
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
> On Mar 13, 2017, at 16:19, jarod_v6--- via Tutor wrote:
>
>
> What can I do for parse better that file and Have only the comma outside the
> string ?
>
I recommend using the cvs module rather than try to write your own.
https://docs.python.org/2/library/csv.html
code and the errors you are getting so we can see what issue
you are having.
—
David Rock
da...@graniteweb.com
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
> On Jun 5, 2017, at 09:36, Schtvveer Schvrveve wrote:
>
>
> And I was rejected. I just wish to understand what I could have done for
> this to be better?
>
> I am a Python beginner, so I'm sure there are things I don't know, but I
> was a bit surprised at the abruptness of the rejection and I
ust keep trying things. When you run into something like this, the
most effective way to troubleshoot is narrow it down to the essential issue.
In this case, “why is the if statement always evaluating to true?” Look at the
parts and re-read what each does (eg, reread how the ‘or’ operator works
encouragement. Thank you.
I’m glad it helped. For completeness, in case you didn’t notice, your elif
statement has the same issue.
elif unit == 'F' or 'f’:
c = (temp - 32) * 5 / 9
print(str(temp) + ' F is equivalent to ' +
f __name__ == '__main__':
#code goes here
vs
def main():
#code goes here
if __name__ == '__main__':
main()
I personally find using main() cumbersome, but many examples I come
across use main(). Is there some fundamental benefit to using main()
that I&
* Alan Gauld via Tutor [2017-07-05 20:36]:
> On 05/07/17 16:37, David Rock wrote:
>
> > This is a question about the benefits of using a main() function vs not.
>
>
> Others have answered for the pros, but I confess that I don't
> always use a main(), but
1 - 100 of 147 matches
Mail list logo