I printed out some random numbers to a list and use 'print mylist' and
they came out like this:
['102\n', '231\n', '463\n', '487\n', '555\n', '961\n']
I was using 'print mylist.rstrip()' to strip off the '\n'
but kept getting an error of :
AttributeError: 'list' object has no attribute 'rstrip
python.org
[mailto:tutor-bounces+bermanrl=cfl.rr@python.org] On Behalf Of Ken G.
Sent: Sunday, January 31, 2010 10:41 AM
To: tutor@python.org
Subject: [Tutor] Future Appointments...
Below is a program to determine when my next appointment is. Line
numbers are provided for reference only.
In using Geany, I have the ability to complied a Python program. For
example, I can complied "program.py" to program.pyc."
What is the purpose of a complied Python program? Can it be transported
to another computer without Python installed as run as it is? For
example, use "run program.pyc"
Below is a program to determine when my next appointment is. Line
numbers are provided for reference only.
01 import time, datetime, sys
02 from datetime import date
03 today = date.today()
04 print
05 print "Today date is:", today
06 todaystr = str(today)
07 print
08 print "Corrected d
maxwell hansen wrote:
I have a decent amount of knowledge with QBASIC and am looking for a
tutor who can help me learn the pythonic equivalent of QBASIC features
and commands such as COLOR, LOCATE, IF...THEN, GOTO, loops, etc. as
well as visual things and objects, which arent available in QBAS
Rich Lovely wrote:
2010/1/2 Ken G. :
Wow, I looked and looked. I can print out my program listing but can not
print the resulted data produced by the program.
How do I print out on my USB printer the data output of my Python program I
ran in my Ubuntu terminal via Geany IDE?
I already
Wow, I looked and looked. I can print out my program listing but can
not print the resulted data produced by the program.
How do I print out on my USB printer the data output of my Python
program I ran in my Ubuntu terminal via Geany IDE?
I already wrote several programs using raw_input, fil
Thanks! So a file will only take a numeric as a string? Lesson learned.
Again, thanks.
Ken
Amit Sethi wrote:
It is as the Error says a type error , the function takes a string and
u are passing an int
if you put
file.write(str(number)) you will not get error ..
__
Thinking it was a reply to me on Python Tutor,
I translated the following into English for the board.
Ken
� DIAGORN wrote:
Bonjour,
Je suis absente jusqu'au 03/01/10 inclus.
En cas d'urgence Soprane, contacter notre adresse générique
projet.sopr...@teamlog.com.
Joyeuses fêtes de fin d'année.
In writing the following program in creating random numbers and writing
them to the file, I get an type error in writing to file. I have tried
number = random(10,99), number = randint(10.99), and number =
random.random(10,00) and still get various errors of writing to file.
If I were to REM o
Che M wrote:
Ken,
I would also recommend trying out databases, if you have an interest.
I found them a fun new aspect of using Python. I would recommend
using SQLite, which very conveniently comes with Python. Alan Gauld's
tutorial that you've read part of has a nice section on Working w
Albert Sweigart wrote:
Ken,
You should probably use the sorting functionality that your DBMS
provides. However, if you have a list of strings that end with a new
line and start with an apostrophe, you can use list comprehensions to
remove them:
newlist = [x[1:-1] for x in newlist]
You can look
Luhmann wrote:
I'd suggest you load all your data into a list of lists, then use the
.sort() method to sort it.
The sort method takes a key= argument, which should be a function that
does some transformation to your data, then returns something to be
compared.
for instance:
>>> l=[[1,2,3],[
I have not use the DBMS as I am unaware of them in both languages.
Lie Ryan wrote:
Ken G. wrote:
The way I use to do it in another programming language (Liberty Basic
in Windows) was:
1. Count number of data entry in database.
2. Dimension or create an array to equal the maximum number of
Greeting: Can someone give me a brief outline of sorting data in
databases? I have five databases with numeric values for each item. To
be more precise, they are sorted by date and if necessary, by time.
Currently, I am using Ubuntu 9.04 in the language of Linux and Python is
my choice of pr
Alan Gauld wrote:
"Ken G." wrote
I am trying to break out of a loop posted below. When asked for
monthdate, it should break out if I entered the number zero and it
does not. GRRR. Been working on this for almost an hour.
monthdate = 999
while monthdate <&
I am trying to break out of a loop posted below. When asked for
monthdate, it should break out if I entered the number zero and it does
not. GRRR. Been working on this for almost an hour.
monthdate = 999
while monthdate <> 0:
monthdate = raw_input('Enter the month and date in t
ALAN GAULD wrote:
> > There is no universal easy way to print stuff unfortunately.
> > In console mode on Unix its not too bad, you can send data
> > to lpr, just as you would from the shell.
> That is a surprise! I was so use to using lprint as in Basic.
BASIC ran on a predefined platform
Alan Gauld wrote:
"Ken G." wrote
Is there a Python command to send data to printer?
I have a Canon MX300 hooked up by USB. I can print from Firefox and
Thunderbird. I am using Ubuntu 9.04 and Python 2.6.2.
There is no universal easy way to print stuff unfortunately.
In conso
Is there a Python command to send data to printer?
I have a Canon MX300 hooked up by USB. I can print from Firefox and
Thunderbird. I am using Ubuntu 9.04 and Python 2.6.2.
I could print to a file and then use gedit to print out the content of
the file but I was wondering if there was an e
Okay, thanks. Understood. It's not a big thing here. Thought I would
ask.
Ken
Alan Gauld wrote:
Ken G. wrote:
I am using Ubuntu 9.04 as my primary OS. I have Windows XP
installed in the first partition (dual boot). I have Python
2.6.2 installed on both OS. The printer is a C
It is possible to print letters sideway in Python?
Instead of printing from left to right on the long side of
a #10 envelope, I wish to print sideway, printing from the
left short edge of envelope to its right short edge.
Thanks,
Ken
___
Tutor mailli
I just reinstalled Python v2.6.2 due to a computer crash. I reinstalled
IDLE v2.6 but I was wondering if there is something better than IDLE.
I am using Ubuntu 9.04 so they do have some limited choices available.
Thanks for your input.
Ken
___
Tuto
I am just starting on Python 2.6.2 on Ubuntu 9.04 and I am slightly
confused with the numerous tutorials and books available for learning
the language. Is there any good recommendation for a good but easy
tutorial on the Internet to learn Python?
Ken
wesley chun wrote:
On Mon, Oct 5, 2009 a
101 - 124 of 124 matches
Mail list logo