Re: best way to remove leading zeros from a tuple like string

2018-05-22 Thread Thomas Jollans
On 2018-05-20 23:54, Paul wrote: > you will find several useful sites where you can test regexes. Regex > errors are very common, even after you have experience with them. What's the benefit of those compared to simply trying out the regex in a Python console? -- https://mail.python.org/mailman/

Re: Issue

2018-05-22 Thread Abdur-Rahmaan Janhangeer
greetings, did you send a log file attached? Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ On Tue, 22 May 2018, 10:28 sujith.j Sjk, wrote: > > Hi, > > > > Am facing the below issue when starting pyton. > > > > > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- h

Re: best way to remove leading zeros from a tuple like string

2018-05-22 Thread Paul
Thomas Jollans wrote: > On 2018-05-20 23:54, Paul wrote: > > you will find several useful sites where you can test regexes. > > What's the benefit of those compared to simply trying out the regex in a > Python console? > Possibly nothing. But there are obvious benefits compared to trying to writ

Re: Issue

2018-05-22 Thread sujith.j Sjk
yes On Tue, May 22, 2018 at 3:04 PM, Abdur-Rahmaan Janhangeer < arj.pyt...@gmail.com> wrote: > greetings, > > did you send a log file attached? > > Abdur-Rahmaan Janhangeer > https://github.com/Abdur-rahmaanJ > > On Tue, 22 May 2018, 10:28 sujith.j Sjk, wrote: > >> > Hi, >> > >> > Am facing the

Problem of writing long list of lists file to csv

2018-05-22 Thread subhabangalore
I have a list of lists (177 lists). I am trying to write them as file. I used the following code to write it in a .csv file. import csv def word2vec_preprocessing(): a1=open("/python27/EngText1.txt","r") list1=[] for line in a1: line1=line.lower().replace(".","").split()

Re: Problem of writing long list of lists file to csv

2018-05-22 Thread Peter Otten
subhabangal...@gmail.com wrote: > lst2=lst1[:4] > with open("my_csv.csv","wb") as f: > writer = csv.writer(f) > writer.writerows(lst2) > > Here it is writing only the first four lists. Hint: look at the first line in the quotation above. -- https://mail.python.org/ma

Re: "Data blocks" syntax specification draft

2018-05-22 Thread bartc
On 22/05/2018 03:49, Mikhail V wrote: On Mon, May 21, 2018 at 3:48 PM, bartc wrote: But I have to say it looks pretty terrible, and I can't see that it buys much over normal syntax. # t # t 11 22 33 Is this example complete? Presumably it means ((11,22,33),). You get the

Re: Issue

2018-05-22 Thread Rhodri James
[Re-ordered for comprehensibility.] On 22/05/18 11:08, sujith.j Sjk wrote: On Tue, May 22, 2018 at 3:04 PM, Abdur-Rahmaan Janhangeer < arj.pyt...@gmail.com> wrote: On Tue, 22 May 2018, 10:28 sujith.j Sjk, wrote: Hi, Am facing the below issue when starting pyton. >> greetings, >> >> did yo

Re: Spam levels.

2018-05-22 Thread C W Rose via Python-list
m wrote: > W dniu 10.02.2018 o 15:57, C W Rose pisze: >> No other groups (in the limited set which I read) have the problem, >> and I don't understand why the spammers neither spam a range of >> groups, nor change their adddresses more frequently. It may be >> that destroying comp.lang.python is

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Chris Angelico
On Tue, May 22, 2018 at 8:25 PM, bartc wrote: > Note that Python tuples don't always need a start symbol: > >a = 10,20,30 > > assigns a tuple to a. The tuple has nothing to do with the parentheses, except for the special case of the empty tuple. It's the comma. ChrisA -- https://mail.python

Re: best way to remove leading zeros from a tuple like string

2018-05-22 Thread Grant Edwards
On 2018-05-22, Thomas Jollans wrote: > On 2018-05-20 23:54, Paul wrote: >> you will find several useful sites where you can test regexes. Regex >> errors are very common, even after you have experience with them. > > What's the benefit of those compared to simply trying out the regex in a > Pytho

Re: best way to remove leading zeros from a tuple like string

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 12:50 AM, Grant Edwards wrote: > On 2018-05-22, Thomas Jollans wrote: >> On 2018-05-20 23:54, Paul wrote: >>> you will find several useful sites where you can test regexes. Regex >>> errors are very common, even after you have experience with them. >> >> What's the benefi

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Ian Kelly
On Tue, May 22, 2018 at 8:25 AM, Chris Angelico wrote: > On Tue, May 22, 2018 at 8:25 PM, bartc wrote: >> Note that Python tuples don't always need a start symbol: >> >>a = 10,20,30 >> >> assigns a tuple to a. > > The tuple has nothing to do with the parentheses, except for the > special case

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Ian Kelly
On Tue, May 22, 2018 at 9:22 AM, Ian Kelly wrote: > On Tue, May 22, 2018 at 8:25 AM, Chris Angelico wrote: >> On Tue, May 22, 2018 at 8:25 PM, bartc wrote: >>> Note that Python tuples don't always need a start symbol: >>> >>>a = 10,20,30 >>> >>> assigns a tuple to a. >> >> The tuple has noth

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 1:22 AM, Ian Kelly wrote: > On Tue, May 22, 2018 at 8:25 AM, Chris Angelico wrote: >> On Tue, May 22, 2018 at 8:25 PM, bartc wrote: >>> Note that Python tuples don't always need a start symbol: >>> >>>a = 10,20,30 >>> >>> assigns a tuple to a. >> >> The tuple has noth

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Ian Kelly
On Tue, May 22, 2018 at 9:34 AM, Chris Angelico wrote: > On Wed, May 23, 2018 at 1:22 AM, Ian Kelly wrote: >> On Tue, May 22, 2018 at 8:25 AM, Chris Angelico wrote: >>> On Tue, May 22, 2018 at 8:25 PM, bartc wrote: Note that Python tuples don't always need a start symbol: a =

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 1:43 AM, Ian Kelly wrote: > On Tue, May 22, 2018 at 9:34 AM, Chris Angelico wrote: >> On Wed, May 23, 2018 at 1:22 AM, Ian Kelly wrote: >>> On Tue, May 22, 2018 at 8:25 AM, Chris Angelico wrote: On Tue, May 22, 2018 at 8:25 PM, bartc wrote: > Note that Python t

Re: Problem of writing long list of lists file to csv

2018-05-22 Thread subhabangalore
On Tuesday, May 22, 2018 at 3:55:58 PM UTC+5:30, Peter Otten wrote: > > > > lst2=lst1[:4] > > with open("my_csv.csv","wb") as f: > > writer = csv.writer(f) > > writer.writerows(lst2) > > > > Here it is writing only the first four lists. > > Hint: look at the first line

Re: "Data blocks" syntax specification draft

2018-05-22 Thread bartc
On 22/05/2018 15:25, Chris Angelico wrote: On Tue, May 22, 2018 at 8:25 PM, bartc wrote: Note that Python tuples don't always need a start symbol: a = 10,20,30 assigns a tuple to a. The tuple has nothing to do with the parentheses, except for the special case of the empty tuple. It's th

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 3:51 AM, bartc wrote: > On 22/05/2018 15:25, Chris Angelico wrote: >> >> On Tue, May 22, 2018 at 8:25 PM, bartc wrote: >>> >>> Note that Python tuples don't always need a start symbol: >>> >>> a = 10,20,30 >>> >>> assigns a tuple to a. >> >> >> The tuple has nothing to

Target WSGI script cannot be loaded as Python module.

2018-05-22 Thread Νίκος
Hello all, Iam tryign to run a bootle script iw rote as wsgi app and iam gettign the follwing eroor. === [Tue May 22 06:49:45.763808 2018] [:error] [pid 24298] [client 46.103.59.37:14500] mod_wsgi (pid=24298): Target WSGI script '/hom

Re: Target WSGI script cannot be loaded as Python module.

2018-05-22 Thread Alexandre Brault
On 2018-05-22 02:29 PM, Νίκος wrote: > Hello all, > > Iam tryign to run a bootle script iw rote as wsgi app and iam gettign the > follwing eroor. > > === > [Tue May 22 06:49:45.763808 2018] [:error] [pid 24298] [client > 46.103.59.37:145

Re: Spam levels.

2018-05-22 Thread Peter J. Holzer
On 2018-05-21 15:42:28 +, Grant Edwards wrote: > I switched from Usenet to Gmane mainly because references headers are > bit more consistent on Gmane, so threading works somewhat better. This is interesting, because Gmane was the reason I switched from reading on usenet to reading the mailingl

Re: what does := means simply?

2018-05-22 Thread Peter J. Holzer
On 2018-05-20 11:37:14 -0400, Dennis Lee Bieber wrote: > On Sun, 20 May 2018 12:38:59 +0100, bartc declaimed the > following: > >Then the /same software/ probably wouldn't work anywhere else. I mean > >taking source which doesn't know or care about what system its on, and > >that operates on a p

Re: Spam levels.

2018-05-22 Thread Grant Edwards
On 2018-05-22, Peter J. Holzer wrote: > On 2018-05-21 15:42:28 +, Grant Edwards wrote: >> I switched from Usenet to Gmane mainly because references headers are >> bit more consistent on Gmane, so threading works somewhat better. > > This is interesting, because Gmane was the reason I switched

Re: what does := means simply?

2018-05-22 Thread Peter J. Holzer
On 2018-05-20 16:36:12 -0400, Richard Damon wrote: > 2) Try to maximize portability by not only looking at the specs, but > also common implementations, and choosing the options that maximize the > acceptability of your output to tools that don't fully meet the specs. > Also, if a common implementa

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-22 Thread Peter J. Holzer
On 2018-05-20 15:43:54 +0200, Karsten Hilbert wrote: > On Sun, May 20, 2018 at 04:59:12AM -0700, bellcanada...@gmail.com wrote: > > > On Saturday, 19 May 2018 19:48:20 UTC-4, Skip Montanaro wrote: > > > As Chris indicated, you'll have to figure out the correct encoding. You > > > might want to ch

Re: Target WSGI script cannot be loaded as Python module.

2018-05-22 Thread Νίκος
Τη Τρίτη, 22 Μαΐου 2018 - 10:55:54 μ.μ. UTC+3, ο χρήστης Alexandre Brault > > Any ideas as to why iam getting the above error although i have python36 > > isntalled along with all modules? why can it find it? > How did you install geoip2? Was it by any chance in a virtual > environment? If it was

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 7:23 AM, Peter J. Holzer wrote: >> The best you can do is to go ask the canonical source of the >> file what encoding the file is _supposed_ to be in. > > I disagree on both counts. > > 1) For any given file it is almost always possible to find the correct >encoding (or

Tkinter and root vs. Wayland

2018-05-22 Thread Grant Edwards
For a couple decades now, I've been distributing a couple smallish Tkinter applications that need to run as root for a variety of reasons (raw Ethernet access, starting/stopping daemons, loading and unloading kernel modules, reading and writing config files that are owned by root). As part of RedH

Re: Spam levels.

2018-05-22 Thread Peter J. Holzer
On 2018-05-22 20:42:43 +, Grant Edwards wrote: > On 2018-05-22, Peter J. Holzer wrote: > > On 2018-05-21 15:42:28 +, Grant Edwards wrote: > >> I switched from Usenet to Gmane mainly because references headers are > >> bit more consistent on Gmane, so threading works somewhat better. > > >

Re: Spam levels.

2018-05-22 Thread Grant Edwards
On 2018-05-22, Peter J. Holzer wrote: > I didn't read on Gmane. I read on my usenet server. But the broken > messages were all coming from Gmane. It is possible that the breakage > only occurs when Gmane passes the message to other Usenet servers, > although I have no idea how that could happen (

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-22 Thread Peter J. Holzer
On 2018-05-23 07:38:27 +1000, Chris Angelico wrote: > On Wed, May 23, 2018 at 7:23 AM, Peter J. Holzer wrote: > >> The best you can do is to go ask the canonical source of the > >> file what encoding the file is _supposed_ to be in. > > > > I disagree on both counts. > > > > 1) For any given file

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 8:31 AM, Peter J. Holzer wrote: > On 2018-05-23 07:38:27 +1000, Chris Angelico wrote: >> On Wed, May 23, 2018 at 7:23 AM, Peter J. Holzer wrote: >> >> The best you can do is to go ask the canonical source of the >> >> file what encoding the file is _supposed_ to be in. >>

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Mikhail V
On Tue, May 22, 2018 at 9:01 AM, Christian Gollwitzer wrote: > Am 22.05.18 um 04:17 schrieb Mikhail V: >>> YAML comes to mind >> >> >> Actually plugging a data syntax in existing language is not a new idea. >> Though I don't know real success stories. >> > > Thing is, you can do it already now in

Getting Unicode decode error using lxml.iterparse

2018-05-22 Thread digitig
I'm trying to read my iTunes library in Python using iterparse. My current stub is: Snip import sys import datetime import xml.etree.ElementTree as ET import argparse import re class Library: unmarshallers = { # collections "array": lambda x: [v.text for v in

RE: "Data blocks" syntax specification draft

2018-05-22 Thread Dan Strohl via Python-list
> -Original Message- > > I think it would be appropriate to propose an alternative to TQS for this > specific purposes. Namely for making it easier to implement parsers and > embedded syntaxes. > > So what do I have now with triple quoted strings - a simple example: > > if 1: > s =

Re: "Data blocks" syntax specification draft

2018-05-22 Thread bartc
On 22/05/2018 16:57, Chris Angelico wrote: On Wed, May 23, 2018 at 1:43 AM, Ian Kelly wrote: In other words, the rule is not really as simple as "commas make tuples". I stand by what I wrote. Neither of us is wrong here. Sorry, but I don't think you're right at all. unless the official r

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Mikhail V
On Tue, May 22, 2018 at 1:25 PM, bartc wrote: > On 22/05/2018 03:49, Mikhail V wrote: >> >> On Mon, May 21, 2018 at 3:48 PM, bartc wrote: >> >> # t >> # t >>11 22 33 >> > > Is this example complete? Presumably it means ((11,22,33),). Yep. > >> You get the point? >> So basically al

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Mikhail V
On Wed, May 23, 2018 at 2:25 AM, Dan Strohl wrote: > >> >> Explanation: >> [here i'll use same symbol /// for the data entry point, but of course it >> can be >> changed if a better idea comes later. Also for now, just for simplicity - >> the rule >> is that the contents of a block starts alway

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 9:51 AM, bartc wrote: > On 22/05/2018 16:57, Chris Angelico wrote: >> >> On Wed, May 23, 2018 at 1:43 AM, Ian Kelly wrote: > > >>> In other words, the rule is not really as simple as "commas make >>> tuples". I stand by what I wrote. >> >> >> Neither of us is wrong here. >

Re: how to handle captcha through machanize module or any module

2018-05-22 Thread SACHIN CHAVAN
On Wednesday, December 18, 2013 at 6:26:17 PM UTC+5:30, Jai wrote: > please do replay how to handle captcha through machanize module I have the same issue, nothing find a solution yet! -- https://mail.python.org/mailman/listinfo/python-list

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Christian Gollwitzer
Am 23.05.18 um 07:22 schrieb Chris Angelico: On Wed, May 23, 2018 at 9:51 AM, bartc wrote: Sorry, but I don't think you're right at all. unless the official references for the language specifically say that commas are primarily for constructing tuples, and all other uses are exceptions to that

Re: Tkinter and root vs. Wayland

2018-05-22 Thread Terry Reedy
On 5/22/2018 5:52 PM, Grant Edwards wrote: For a couple decades now, I've been distributing a couple smallish Tkinter applications that need to run as root for a variety of reasons (raw Ethernet access, starting/stopping daemons, loading and unloading kernel modules, reading and writing config fi

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Ian Kelly
On Tue, May 22, 2018 at 11:32 PM, Christian Gollwitzer wrote: > Am 23.05.18 um 07:22 schrieb Chris Angelico: >> >> On Wed, May 23, 2018 at 9:51 AM, bartc wrote: >>> >>> Sorry, but I don't think you're right at all. unless the official >>> references >>> for the language specifically say that comm

Re: Spam levels.

2018-05-22 Thread dieter
"Peter J. Holzer" writes: > ... > I didn't read on Gmane. I read on my usenet server. But the broken > messages were all coming from Gmane. I am reading with an NNTP client connected to the Gmane NNTP server and and threading works - with very rare exceptions. The exeptions are so rare, that they

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Chris Angelico
On Wed, May 23, 2018 at 3:32 PM, Christian Gollwitzer wrote: > Am 23.05.18 um 07:22 schrieb Chris Angelico: >> >> On Wed, May 23, 2018 at 9:51 AM, bartc wrote: >>> >>> Sorry, but I don't think you're right at all. unless the official >>> references >>> for the language specifically say that comma

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Marko Rauhamaa
Christian Gollwitzer : > I'd think that the definitive answer is in the grammar, because that is > what is used to build the Python parser: > > https://docs.python.org/3/reference/grammar.html > > Actually, I'm a bit surprised that tuple, list etc. does not appear > there as a non-terminal.

Re: UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 10442: character maps to

2018-05-22 Thread Steven D'Aprano
On Wed, 23 May 2018 00:31:03 +0200, Peter J. Holzer wrote: > On 2018-05-23 07:38:27 +1000, Chris Angelico wrote: [...] >> You can find an encoding which is capable of decoding a file. That's >> not the same thing. > > If the result is correct, it is the same thing. But how do you know what is co

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Ian Kelly
On Wed, May 23, 2018 at 12:01 AM, Ian Kelly wrote: > On Tue, May 22, 2018 at 11:32 PM, Christian Gollwitzer > wrote: >> Am 23.05.18 um 07:22 schrieb Chris Angelico: >>> >>> On Wed, May 23, 2018 at 9:51 AM, bartc wrote: Sorry, but I don't think you're right at all. unless the official

Re: Getting Unicode decode error using lxml.iterparse

2018-05-22 Thread dieter
digi...@gmail.com writes: > I'm trying to read my iTunes library in Python using iterparse. My current > stub is: > ... > My input file (reduced to home in on the error) is: > > snip - > > > > > > 15078 > > NamePart 2. The Deat

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Steven D'Aprano
On Tue, 22 May 2018 18:51:30 +0100, bartc wrote: > On 22/05/2018 15:25, Chris Angelico wrote: [...] >> The tuple has nothing to do with the parentheses, except for the >> special case of the empty tuple. It's the comma. > > No? Take these: > > a = (10,20,30) > a = [10,20,30] > a = {10,20,3

Re: "Data blocks" syntax specification draft

2018-05-22 Thread Steven D'Aprano
On Tue, 22 May 2018 09:43:55 -0600, Ian Kelly wrote: > In other words, the rule is not really as simple as "commas make > tuples". I stand by what I wrote. Being pedantic is great, but if you're going to be pedantic, it pays to be *absolutely correctly* pedantic *wink* Chris is right to say "co