On Wed, Aug 8, 2018 at 8:30 PM boB Stepp wrote:
>
> On Tue, Aug 7, 2018 at 9:13 AM Rafael Knuth wrote:
Curses! Sorry, Chris! This should be:
> > Chris Warrick wrote:
> > > Also, consider using snake_case instead of PascalCase for your
> > > function name, since the latter is typically used fo
On Tue, Aug 7, 2018 at 9:13 AM Rafael Knuth wrote:
> Alan Gauld wrote:
> > Also, consider using snake_case instead of PascalCase for your
> > function name, since the latter is typically used for classes, and
> > perhaps call it read_file to better describe it?
>
> thanks, I wasn't aware of the n
Question is already answered, just wanted to add a mini-note.
def FileReader(file_path):with open(file_path) as file_object:
contents = file_object.readreturn contents
you /can/ return the read method here, which is what this typo does. And
the caller of the function can use it to
> You forgot the parentheses (), and are returning a reference to the
> function instead of calling it and returning its result. Do this:
> contents = file_object.read()
oh, my bad. Thanks!
> Also, consider using snake_case instead of PascalCase for your
> function name, since the latter
On 07/08/18 13:46, Rafael Knuth wrote:
> Now I want to convert the code above into a function.
> This is what I wrote:
>
> def FileReader(file_path):
> with open(file_path) as file_object:
> contents = file_object.read
> return contents
>
> print(FilePrinter("C:\\Users\\...\\
On Tue, 7 Aug 2018 at 15:07, Rafael Knuth wrote:
> def FileReader(file_path):
> with open(file_path) as file_object:
> contents = file_object.read
> return contents
>
> print(FilePrinter("C:\\Users\\...\\MyFile.txt")) # path shortened for
> better readability
>
> I got this err
Hi there,
I got this here:
file_path = "C:\\Users\\...\\MyFile.txt" # path shortened for better readability
with open(file_path) as file_object:
contents = file_object.read()
print(contents)
It works.
Now I want to convert the code above into a function.
This is what I wrote:
def FileR
On Mon, Mar 24, 2008 at 6:28 AM, Bartruff, Pamela J. <
[EMAIL PROTECTED]> wrote:
> Def convert_time(time):
> """split hours from minutes"
> Time = raw_input("enter a time, in military: ")
>
At this point, Time is a string, not a number. (At this point, we also have
to _assume_ that the user ente
Thank you so much. I appreciate the help, I am very new to Python, but
I would very much like to learn more...
-Original Message-
From: bhaaluu [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2008 9:17 AM
To: Bartruff, Pamela J.
Cc: tutor@python.org
Subject: Re: [Tutor] how to write a
On Mon, Mar 24, 2008 at 8:07 AM, Bartruff, Pamela J.
<[EMAIL PROTECTED]> wrote:
>
> Hello Python users,
>
> I am very new to Python, how do I program that converts 24 hour time to 12
> hour time? The program should have three functions(input, conversion and
> output function)
>
> Thanks for any he
m."
-Original Message-
From: Kent Johnson [mailto:[EMAIL PROTECTED]
Sent: Monday, March 24, 2008 8:07 AM
To: Bartruff, Pamela J.
Cc: tutor@python.org
Subject: Re: [Tutor] how to write a function
Bartruff, Pamela J. wrote:
> Hello Python users,
>
> I am very new to Pyth
Bartruff, Pamela J. wrote:
> Hello Python users,
>
> I am very new to Python, how do I program that converts 24 hour time to
> 12 hour time? The program should have three functions(input, conversion
> and output function)
This sounds like a homework assignment. We will help with homework but
Hello Python users,
I am very new to Python, how do I program that converts 24 hour time to
12 hour time? The program should have three functions(input, conversion
and output function)
Thanks for any help
Pamela Bartruff
___
Tutor maillist -
13 matches
Mail list logo