On 04/25/2016 11:21 PM, San wrote:
Hi All,
Pls let me why
"
def __init__(self):
"
declaration required, what's the use of this one.Pls explain me in details.
Thanks in advance.
If you understand object-oriented-programming, then this will make sense:
The __init__ method is the construct
Gary Herron writes:
>The __init__ method is the constructor for instances of a class. It
>is not required, but the situations in which a constructor is not
>needed are few and unusual.
That's needlessly confusing: ‘__init__’ is not a constructor because it
does not construct the ins
Ben Finney :
> Gary Herron writes:
>
>>The __init__ method is the constructor for instances of a class.
>>It is not required, but the situations in which a constructor is
>>not needed are few and unusual.
>
> That's needlessly confusing: ‘__init__’ is not a constructor because
> it do
On 25 April 2016 at 15:35, Derek Klinge wrote:
>
> Although I see the value of relative error, I am just as interested in
> absolute error (though admittedly they are directly related values).
I was referring to relative error because the relative error is the
same at each step making the calcula
On Monday, April 25, 2016 at 6:04:24 PM UTC+5:30, Peter Otten wrote:
> harirammano...@gmail.com wrote:
>
> >> tree.write('output.xml')
> >
> > yup its working well if i include register namespace, else i am getting
> > ns:0 in every line of output.xml.
> >
> > But its removing top line
> >
>
On 2016-04-25 22:37, pannis2...@gmail.com wrote:
> I am trying send email through smtplib
> body = "test"
> message = """\
> From: %s
> To: %s
> Subject: %s
> %s
> """ % (FROM, ", ".join(TO), SUBJECT, body)
Doesn't the email RFC require a blank line between the headers
On Tue, Apr 26, 2016, at 03:34, Ben Finney wrote:
> That's needlessly confusing: ‘__init__’ is not a constructor because it
> does not construct the instance. The ‘__new__’ method is the constructor
> for a class (and returns the new instance).
the __new__ method is the *allocator*. "constructor"
I recently discovered pathlib in the Python 3 standard library, & find
it very useful, but I'm a bit surprised that it doesn't offer things
like is_readable() and is_writable. Is there a good reason for that?
I've been improvising with things like this:
import pathlib, os
path = pathlib.Path('s
On Tue, Apr 26, 2016, at 09:30, Adam Funk wrote:
> I recently discovered pathlib in the Python 3 standard library, & find
> it very useful, but I'm a bit surprised that it doesn't offer things
> like is_readable() and is_writable. Is there a good reason for that?
Well, one reason would be EAFP. J
I am learning python.
if I have a csv file, like this
banana,4.0
apple,3.5
orange,3.0
Can anyone show me how to read the csv file line by line and then create a
dictionary to contain these keys and values?
Regards,
+dime+
--
https://mail.python.org/mailman/listinfo/python-list
On 04/26/2016 06:49 AM, Random832 wrote:
On Tue, Apr 26, 2016, at 03:34, Ben Finney wrote:
That's needlessly confusing: ‘__init__’ is not a constructor because it
does not construct the instance. The ‘__new__’ method is the constructor
for a class (and returns the new instance).
the __new__ met
+dime+ wrote:
> I am learning python.
>
> if I have a csv file, like this
> banana,4.0
> apple,3.5
> orange,3.0
>
> Can anyone show me how to read the csv file line by line and then create a
> dictionary to contain these keys and values?
Below is a spoiler, but learning Python is more fun and y
Hey guys,
We just launched rinocloud.com, it aims to make it easy to manage datasets in
python. I hope some of you could take a look at it and give us some feedback.
We made the library to create a better way to organize datasets and parameters
from simulations and experiments
Instead of just s
On Tue, Apr 26, 2016 at 7:18 AM, +dime+ wrote:
> I am learning python.
>
> if I have a csv file, like this
> banana,4.0
> apple,3.5
> orange,3.0
>
> Can anyone show me how to read the csv file line by line and then create a
> dictionary to contain these keys and values?
>
>
> Regards,
> +dime+
>
Hi all,
I have a python34 installed on a windows-64bit machine. I am using Eclipse
pydev editor. I need to used griddata from scipy.interpolate.
I have installed scipy using by downloading the followng wheel file:
scipy-0.17.0-cp34-none-win_amd64
and isntalling using pip install. The install
On Monday, April 25, 2016 at 10:07:13 PM UTC+5:30, Steven D'Aprano wrote:
> On Tue, 26 Apr 2016 12:56 am, wrote:
>
> > Dear Group,
> >
> > I have a list of tuples, as follows,
> >
> > list1=[u"('koteeswaram/BHPERSN engaged/NA himself/NA in/NA various/NA
> [... 17 more lines of data ...]
>
> Hi
On Monday, April 25, 2016 at 10:07:13 PM UTC+5:30, Steven D'Aprano wrote:
>
>
> > Dear Group,
> >
> > I have a list of tuples, as follows,
> >
> > list1=[u"('koteeswaram/BHPERSN engaged/NA himself/NA in/NA various/NA
> [... 17 more lines of data ...]
>
> Hi Subhabrata, and thanks for the quest
On Tue, 26 Apr 2016 11:30 pm, Adam Funk wrote:
> I recently discovered pathlib in the Python 3 standard library, & find
> it very useful, but I'm a bit surprised that it doesn't offer things
> like is_readable() and is_writable. Is there a good reason for that?
Maybe nobody thought of it. Why do
On Tue, Apr 26, 2016, at 11:38, subhabangal...@gmail.com wrote:
> I am trying to send you a revised example.
> list1=[u"('koteeswaram/BHPERSN engaged/NA ','class1')",
> u"('koteeswaram/BHPERSN is/NA ','class1')"]
>
> [('koteeswaram/BHPERSN engaged/NA ','class1'),
> ('koteeswaram/BHPERSN is/NA '
I am wondering how to make my code function so it does not allow any of the
same values to be entered into a column in my CSV file created through python.
So I need to read into the CSV file and check if any names have already been
entered. If they have, the user must not be allowed to enter thi
On Tue, Apr 26, 2016 at 12:01 PM, wrote:
> I am wondering how to make my code function so it does not allow any of the
> same values to be entered into a column in my CSV file created through
> python. So I need to read into the CSV file and check if any names have
> already been entered. If t
On Tue, Apr 26, 2016 at 10:01 AM, wrote:
> I am wondering how to make my code function so it does not allow any of the
> same values to be entered into a column in my CSV file created through
> python. So I need to read into the CSV file and check if any names have
> already been entered. If t
On Tue, 26 Apr 2016 06:25 pm, Marko Rauhamaa wrote:
> Ben Finney :
>
>> Gary Herron writes:
>>
>>>The __init__ method is the constructor for instances of a class.
>>>It is not required, but the situations in which a constructor is
>>>not needed are few and unusual.
>>
>> That's needl
On Tue, Apr 26, 2016, at 12:12, Steven D'Aprano wrote:
> The obvious reason for overriding __new__ is to construct an immutable
> instance. You have to override __new__, because by the time it returns
> the
> instance is immutable and you can no longer initialise it.
Other than by subclassing an e
On Wed, 27 Apr 2016 01:38 am, subhabangal...@gmail.com wrote:
> I am trying to send you a revised example.
> list1=[u"('koteeswaram/BHPERSN engaged/NA ','class1')",
> u"('koteeswaram/BHPERSN is/NA ','class1')"]
Please don't use generic names that mean nothing like "list1". We can see it
is a li
On 2016-04-26 07:18, +dime+ wrote:
> I am learning python.
>
> if I have a csv file, like this
> banana,4.0
> apple,3.5
> orange,3.0
>
> Can anyone show me how to read the csv file line by line and then
> create a dictionary to contain these keys and values?
import csv
with open('data.csv') as f
On Wed, 27 Apr 2016 02:26 am, Random832 wrote:
> On Tue, Apr 26, 2016, at 12:12, Steven D'Aprano wrote:
>> The obvious reason for overriding __new__ is to construct an immutable
>> instance. You have to override __new__, because by the time it returns
>> the
>> instance is immutable and you can no
Steven D'Aprano :
> On Tue, 26 Apr 2016 06:25 pm, Marko Rauhamaa wrote:
>> Check out some of the stdlib source code for example:
>>
>>
>> class ThreadPoolExecutor(_base.Executor):
>> def __init__(self, max_workers):
>>
On Tue, Apr 26, 2016 at 9:32 AM, Steven D'Aprano
wrote:
> Subclassing immutable built-ins is the most obvious and simple (and
> probably
> common) way to get an immutable class. Actually immutable, short of doing
> wicked things with ctypes.
>
By wicked things with ctypes, do you mean something
On Tuesday, 26 April 2016 17:14:36 UTC+1, Ian wrote:
> On Tue, Apr 26, 2016 at 10:01 AM, wrote:
> > I am wondering how to make my code function so it does not allow any of the
> > same values to be entered into a column in my CSV file created through
> > python. So I need to read into the CSV
On Wed, Apr 27, 2016 at 2:59 AM, Chris Kaynor wrote:
> On Tue, Apr 26, 2016 at 9:32 AM, Steven D'Aprano
> wrote:
>
>> Subclassing immutable built-ins is the most obvious and simple (and
>> probably
>> common) way to get an immutable class. Actually immutable, short of doing
>> wicked things with
On Tuesday, 26 April 2016 17:09:10 UTC+1, Joel Goldstick wrote:
> On Tue, Apr 26, 2016 at 12:01 PM, wrote:
> > I am wondering how to make my code function so it does not allow any of the
> > same values to be entered into a column in my CSV file created through
> > python. So I need to read in
On Tuesday, 26 April 2016 17:01:41 UTC+1, Adam Davis wrote:
> I am wondering how to make my code function so it does not allow any of the
> same values to be entered into a column in my CSV file created through
> python. So I need to read into the CSV file and check if any names have
> already
On Tue, Apr 26, 2016 at 10:04 AM, Chris Angelico wrote:
> On Wed, Apr 27, 2016 at 2:59 AM, Chris Kaynor
> wrote:
> > On Tue, Apr 26, 2016 at 9:32 AM, Steven D'Aprano
> > wrote:
> >
> >> Subclassing immutable built-ins is the most obvious and simple (and
> >> probably
> >> common) way to get an
Hi
I have written a very simple program to read and print data from the serial
port using pyserial:
#!/usr/bin/python3
import serial
ser=serial.Serial('COM1',115200)
while True:
out = ser.read()
print('Receiving...'+out)
When I run it and send data for it to read I get:
C:\SVNProj\Rag
On Tue, Apr 26, 2016 at 11:13 AM, Chris Kaynor wrote:
> Yah, if you really wanted to make it work properly, you'd need to incref
> the newValue, while decref the oldValue. The incref would not be that
> difficult, but the decref would be more challenging, as you may have to
> also destroy the old
On Wed, Apr 27, 2016 at 3:13 AM, Chris Kaynor wrote:
> Yah, if you really wanted to make it work properly, you'd need to incref
> the newValue, while decref the oldValue. The incref would not be that
> difficult, but the decref would be more challenging, as you may have to
> also destroy the old o
David Aldrich wrote:
> Hi
>
> I have written a very simple program to read and print data from the
> serial port using pyserial:
>
> #!/usr/bin/python3
> import serial
>
> ser=serial.Serial('COM1',115200)
> while True:
> out = ser.read()
> print('Receiving...'+out)
>
> When I run it an
If you want to read an entire file, append a space and asterisk and write it to
another file, this is the code you need:
infile = open('win.txt', 'r')
text = f.read()
infile.close()
text += " *"
outfile = open('outfile.txt', 'w')
outfile.write(text)
outfile.close()
If, on the other hand, you wis
On 2016-04-26, David Aldrich wrote:
> #!/usr/bin/python3
> import serial
>
> ser=serial.Serial('COM1',115200)
> while True:
> out = ser.read()
> print('Receiving...'+out)
>
> When I run it and send data for it to read I get:
> Traceback (most recent call last):
> File "serial_read.py",
Just an example. Didn't use the csv but just hope that it helps.
name=[]
name_exist="Dop"
with open("dop.csv") as f:
for line in f:
line_split=line.split(',')
name.append(line_strip[0])
if name_exist in name:
print "found name " + na
On Tue, Apr 26, 2016 at 11:00 AM, Adam Davis wrote:
> On Tuesday, 26 April 2016 17:14:36 UTC+1, Ian wrote:
>> On Tue, Apr 26, 2016 at 10:01 AM, wrote:
>> > I am wondering how to make my code function so it does not allow any of
>> > the same values to be entered into a column in my CSV file cr
On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola
wrote:
> Just an example. Didn't use the csv but just hope that it helps.
>
> name=[]
> name_exist="Dop"
>
> with open("dop.csv") as f:
> for line in f:
> line_split=line.split(',')
> name.append(line_strip[0])
On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote:
> On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola
> wrote:
> > Just an example. Didn't use the csv but just hope that it helps.
> >
> > name=[]
> > name_exist="Dop"
> >
> > with open("dop.csv") as f:
> > for line in f:
> >
On Tue, Apr 26, 2016 at 2:07 PM, Adam Davis wrote:
> On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote:
>> On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola
>> wrote:
>> > Just an example. Didn't use the csv but just hope that it helps.
>> >
>> > name=[]
>> > name_exist="Dop"
>> >
>> > with open
On 2016-04-26 21:07, Adam Davis wrote:
On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote:
On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola
wrote:
> Just an example. Didn't use the csv but just hope that it helps.
>
> name=[]
> name_exist="Dop"
>
> with open("dop.csv") as f:
> for line
Hello Associates,
Please go through the below job description and let me know your interest.
Please revert me: soura...@itscient.com or sourav524.itsci...@gmail.com.
Position: IBM BPM Technical Lead
Location: Warren, NJ
Duration: 6+ Months
Requisition Details:
Skills, Required Experience and
I have PyGame installed.
As soon as I run pygame.init() or pygame.display.init(), a PyGame icon
will pop up in the Dock, and then its application will simply stop
responding. Needless to say, I can't actually do anything with it.
What is this application, and what is likely the problem with it?
On Tue, Apr 26, 2016 at 3:33 PM, D.M. Procida
wrote:
> I have PyGame installed.
>
> As soon as I run pygame.init() or pygame.display.init(), a PyGame icon
> will pop up in the Dock, and then its application will simply stop
> responding. Needless to say, I can't actually do anything with it.
>
> W
sourav524.itsci...@gmail.com writes:
> Hello Associates,
> Please go through the below job description and let me know your
> interest.
Hello recruiters,
Please don't use Python discussion forums for recruiting. Instead, use
the Python Job Board which is maintained specifically for that purpose
>> I am learning python.
>>
>> if I have a csv file, like this
>> banana,4.0
>> apple,3.5
>> orange,3.0
>>
>> Can anyone show me how to read the csv file line by line and then
>> create a dictionary to contain these keys and values?
with open('data.csv') as f:
data = dict([[l.strip() for l
import csv
Use dictionary {key:value}
-Original Message-
From: Python-list
[mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf Of
peakgraph...@gmail.com
Sent: 26 April 2016 17:01
To: python-list@python.org
Subject: Howw to prevent the duplication of any value in
Try print('blaba'+str(out))
saludos,
desde un móvil.
El abr 26, 2016 2:33 p.m., "Grant Edwards"
escribió:
> On 2016-04-26, David Aldrich wrote:
>
> > #!/usr/bin/python3
> > import serial
> >
> > ser=serial.Serial('COM1',115200)
> > while True:
> > out = ser.read()
> > print('Receiving..
Gonzalo V writes:
> Try print('blaba'+str(out))
I doubt that gives the desired result for a bytes object. Did you try it?
>>> foo = b'\xde\xad\xbe\xef'
>>> str(foo)
"b'\\xde\\xad\\xbe\\xef'"
>>> print(str(foo))
b'\xde\xad\xbe\xef'
Yes, the “b'” and backslashes are all part
Just curious:-) why everyone here open the csv file without using newline='' as
suggested in Python 3.4.4 document section 14.1?
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 26 Apr 2016 11:53:57 +1000, Steven D'Aprano
wrote:
>On Tue, 26 Apr 2016 08:04 am, Seymore4Head wrote:
>
>> BTW I was trying to use a line like yours that used an output file
>> that didn't exist and was getting an error. I assume that import os
>> fixes that.
>
>
>Why would you assume th
On Tue, 26 Apr 2016 19:16:56 +0100, Michael
wrote:
>If you want to read an entire file, append a space and asterisk and write it
>to another file, this is the code you need:
>
>infile = open('win.txt', 'r')
>text = f.read()
>infile.close()
>text += " *"
>outfile = open('outfile.txt', 'w')
>outfi
On Wed, Apr 27, 2016 at 12:56 PM, Seymore4Head
wrote:
> On Tue, 26 Apr 2016 11:53:57 +1000, Steven D'Aprano
> wrote:
>
>>On Tue, 26 Apr 2016 08:04 am, Seymore4Head wrote:
>>
>>> BTW I was trying to use a line like yours that used an output file
>>> that didn't exist and was getting an error. I a
Greetings,
If I'm using a dictionary to store variables for an object, and
accessing the variable values from dictionary via property decorators,
would it be better to derive the class from object or dict?
class Test1(object):
def __init__(self):
self.state = {'key': '
Christopher Reimer writes:
> If I'm using a dictionary to store variables for an object, and
> accessing the variable values from dictionary via property decorators
Why not use the built-in ‘dict’ type?
What does the new type do which isn't already better served by the
built-in ‘dict’ type?
(N
On Tue, Apr 26, 2016, at 23:43, Christopher Reimer wrote:
> Greetings,
>
> If I'm using a dictionary to store variables for an object, and
> accessing the variable values from dictionary via property decorators,
what exactly do you mean by property decorators? If you're just
accessing them in a
On Wednesday 27 April 2016 02:59, Chris Kaynor wrote:
> On Tue, Apr 26, 2016 at 9:32 AM, Steven D'Aprano
> wrote:
>
>> Actually immutable, short of doing wicked things with ctypes.
>>
>
> By wicked things with ctypes, do you mean something like this? By no means
> do I suggest this actually be
On 04/26/2016 08:43 PM, Christopher Reimer wrote:
If I'm using a dictionary to store variables for an object, and
accessing the variable values from dictionary via property decorators,
would it be better to derive the class from object or dict?
class Test1(object):
def __init__(se
On 04/26/2016 08:54 PM, Ben Finney wrote:
(Note that “allow attribute-syntax access to dictionary items” does not
qualify as “better”, IMO; it qualifies as “needlessly confusing distinct
concepts”.)
Well, since one of the side-effects of class instances is to provide
"attribute-syntax access
On Tuesday, 26 April 2016 21:23:58 UTC+1, MRAB wrote:
> On 2016-04-26 21:07, Adam Davis wrote:
> > On Tuesday, 26 April 2016 20:52:54 UTC+1, Ian wrote:
> >> On Tue, Apr 26, 2016 at 1:05 PM, Joaquin Alzola
> >> wrote:
> >> > Just an example. Didn't use the csv but just hope that it helps.
> >> >
On Wed, Apr 27, 2016 at 4:26 PM, Adam Davis wrote:
> I understand what you're saying! But where you say: " the_set = set()", what
> would go within the set brackets?
Nothing. The empty parentheses mean "call this with no arguments", and
when you call the set constructor like that, you get back a
in 758723 20160427 000706 Ben Finney wrote:
>sourav524.itsci...@gmail.com writes:
>
>> Hello Associates,
>> Please go through the below job description and let me know your
>> interest.
>
>Hello recruiters,
>
>Please don't use Python discussion forums for recruiting. Instead, use
>the Python Job B
67 matches
Mail list logo