On Sun, Oct 26, 2014 at 3:25 PM, Malik Brahimi wrote:
> So I am working with input that is pasted from a PDF file, and I was
> wondering if there is any way I can do so without the program terminating
> abruptly because of the newlines.
input() and raw_input() grab a single line of text. The rest
Malik Brahimi writes:
> So I am working with input that is pasted from a PDF file, and I was
> wondering if there is any way I can do so without the program
> terminating abruptly because of the newlines.
Can you construct a *very* short and simple example program, which
demonstrates the problem
So I am working with input that is pasted from a PDF file, and I was
wondering if there is any way I can do so without the program terminating
abruptly because of the newlines. I know that multiple lines of input can
be achieved via a loop with string concatenation, but this is not what I'm
looking
"Jason Staudenmayer" wrote
I'm working on a small program to add users to a sqlite db.
Try the database topic in my tutorial where I do a very similar
thing...
code follows -
def promptInput():
...
result = (lname, fname, email)
return result
def getEmplyInfo():
> -Original Message-
> From: Alex Hall [mailto:mehg...@gmail.com]
> Sent: Wednesday, January 05, 2011 3:23 PM
> To: Jason Staudenmayer
> Cc: tutor@python.org
> Subject: Re: [Tutor] user input help
>
>
> On 1/5/11, Jason Staudenmayer wrote:
> > Hi all,
On 1/5/11, Jason Staudenmayer wrote:
> Hi all, I'm pretty new to programming in general and figured I'd try out
> python.
> I'm working on a small program to add users to a sqlite db. The problem I'm
> having it dealing with the user input, I'd like to be able to repeat the
> function to get the i
Hi all, I'm pretty new to programming in general and figured I'd try out
python.
I'm working on a small program to add users to a sqlite db. The problem I'm
having it dealing with the user input, I'd like to be able to repeat the
function to get the input if the user doesn't accept it.
here's
On 2/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Every example of a list that I've seen involves working with, sorting, etc
> pre-populated list. How can I create a list where the user inputs a string
> of numbers and then sorts it?
The code of yours gets a commaseparated _string_, whi
Every example of a list that I've seen involves working with, sorting, etc
pre-populated list. How can I create a list where the user inputs a string
of numbers and then sorts it?
I've tried:
print "Input list separated by commas"
lst=[raw_input()]
print lst
print len(lst)
lst.sort()
print lst
> The second version works.
>
> print "Total trip cost is US$", float(distance) /
> (float(mpg) * float(galon_price))
Hi Matt,
Although this works, we'll probably want to do the type conversions as
early as possible. We can write a function input_float() that wraps up
the float(raw_input()) s
Thanks Kelly.
The second version works.
print "Total trip cost is US$", float(distance) /(float(mpg) * float(galon_price))Matt
From: Kelly Vincent <[EMAIL PROTECTED]>To: MATATA EMMANUEL <[EMAIL PROTECTED]>, Tutor@python.orgSubject: Re: [Tutor] User inputDate: Mon, 22 May 2006 15:19:12 +
re more experienced may have suggestions for more elegant code.
Urban Landreman
>From: "MATATA EMMANUEL" <[EMAIL PROTECTED]>
>To: Tutor@python.org
>Subject: [Tutor] User input
>Date: Mon, 22 May 2006 09:58:04 -0400
>MIME-Version: 1.0
>X-Originating-IP: [199.90
raw_input reads in the value as a string, so you need
to convert it at some point to a number. You can
either do this at the point where you read the value
in, or when you do the calculation/print.
To convert it at the input stage (probably the most
logical), add float() such as
mpg = float(raw_i
MATATA EMMANUEL wrote:
> Hi there,
>
> Can anyone tell me how I'm having trouble executing this piece of code:
>
> mpg = raw_input (" Enter your mileage:")
> distance = raw_input ("Enter your distance:")
> galon_price = raw_input ("Enter you cost per gallon:")
> make = "Honda"
> model = "Accord"
Hi there,
Can anyone tell me how I'm having trouble executing this piece of code:
mpg = raw_input (" Enter your mileage:")distance = raw_input ("Enter your distance:")galon_price = raw_input ("Enter you cost per gallon:")make = "Honda"model = "Accord"##print make, model, "mileage is", mpg, "miles
15 matches
Mail list logo