Re: Python 3

2020-11-07 Thread Barry Scott
> On 7 Nov 2020, at 06:51, Nick Li wrote: > > Does anyone know how to turn a decimal number into duodecimal or if there is > a function built-in for it? I see lots of interesting answer in here: https://stackoverflow.com/questions/2267362/how-to-convert-an-integer-to-a-string-in-any-base

Re: Python 3

2020-11-07 Thread Hernán De Angelis
Hi, Wikipedia has an article on the duodecimal system, that includes an explanation of how to convert from decimal and the other way around. https://en.wikipedia.org/wiki/Duodecimal?wprov=sfla1 Peerrhaps it can be easily implemented as a function. Good luck. H. Den lör 7 nov. 2020 07:55Nick

strip() method makes me confused

2020-11-07 Thread Bischoop
According to documentation strip method removes heading and trailing characters. Why then: txt = ",rrttggs...,..s,bananas...s.rrr" x = txt.strip(",s.grt") print(x) output: banana another example: text = "this is text, there should be not commas, but as you see there are still" y = txt.

Re: strip() method makes me confused

2020-11-07 Thread Alexander Neilson
Because the strip methods argument is the set of characters to remove from either end. So it checks from the ends character by character until it finds a character that isn’t in the set. Then it removes everything prior to that (or after that at end of the string) and then returns the result.

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
On 2020-11-07 1:03 PM, Bischoop wrote: According to documentation strip method removes heading and trailing characters. Both are explained in the docs - Why then: txt = ",rrttggs...,..s,bananas...s.rrr" x = txt.strip(",s.grt") print(x) output: banana "The chars argument is not a p

Re: strip() method makes me confused

2020-11-07 Thread Frank Millman
On 2020-11-07 1:28 PM, Frank Millman wrote: On 2020-11-07 1:03 PM, Bischoop wrote: [...] another example: text = "this is text, there should be not commas, but as you see there are still" y = txt.strip(",") print(text) output: this is text, there should be not commas, but as you see there

Re: Questions about XML processing?

2020-11-07 Thread Shaozhong SHI
Hi, Hernan, Did you try to parse GML? Surely, there can be very concise and smart ways to do these things. Regards, David On Fri, 6 Nov 2020 at 20:57, Hernán De Angelis wrote: > Thank you Terry, Dan and Dieter for encouraging me to post here. I have > already solved the problem albeit with a

Re: Questions about XML processing?

2020-11-07 Thread Hernán De Angelis
No, it is XML metadata. I also believe there should be a better way using [@...] expressions in the path. H. Den lör 7 nov. 2020 13:14Shaozhong SHI skrev: > Hi, Hernan, > > Did you try to parse GML? > > Surely, there can be very concise and smart ways to do these things. > > Regards, > > David

Re: strip() method makes me confused

2020-11-07 Thread Bischoop
On 2020-11-07, Frank Millman wrote: > On 2020-11-07 1:28 PM, Frank Millman wrote: >> On 2020-11-07 1:03 PM, Bischoop wrote: >>> > [...] >>> >>> another example: >>> >>> text = "this is text, there should be not commas, but as you see there >>> are still" >>> y = txt.strip(",") >>> print(text) >>>

Re: strip() method makes me confused

2020-11-07 Thread Bischoop
On 2020-11-07, Alexander Neilson wrote: > Because the strip methods argument is the set of characters to remove from > either end. So it checks from the ends character by character until it finds > a character that isn’t in the set. Then it removes everything prior to that > (or after that at e

Any better way for this removal?

2020-11-07 Thread Bischoop
So I was training with slicing. Came to idea to remove text after second occurence of character, below is how I've figured it out, I know if it works it good but how you guys would made it in more pythonic way? text = "This is string, remove text after second comma, to be removed." k= (t

Re: Any better way for this removal?

2020-11-07 Thread inhahe
> > > On Sat, Nov 7, 2020 at 8:51 AM Bischoop wrote: > >> >> >> So I was training with slicing. >> Came to idea to remove text after second occurence of character, below >> is how I've figured it out, I know if it works it good but how you >> guys would made it in more pythonic way? >> >> text

Re: Any better way for this removal?

2020-11-07 Thread Mike
Use .split() to split the string on the character and then use .join() to rejoin the first 2 tokens tokens = text.split(“,”) new_string = “,”.join(tokens[:2]) On Sat, Nov 7, 2020, at 1:46 PM, Bischoop wrote: > > > So I was training with slicing. > Came to idea to remove text after second occu

Trouble Uninstalling Python 3.7.9 & 3.8.6 on Windows 10

2020-11-07 Thread Tanmay Deshpande
Hi there, I have been using multiple versions of Python on my laptop running Windows 10. I installed 3.7.9 (64-bit) for my school work and 3.8.6 (64-bit) for my personal usage. *Build Number: 19041.572* I had decided to uninstall both Python versions from my system as I wanted to have a clean

Re: Any better way for this removal?

2020-11-07 Thread Tim Chase
On 2020-11-07 13:46, Bischoop wrote: > text = "This is string, remove text after second comma, to be > removed." > > k= (text.find(",")) #find "," in a string > m = (text.find(",", k+1)) #Find second "," in a string > new_string = text[:m] > > print(new_string) How about: new_string = text.r

RE: Is there a conflict of libraries here?

2020-11-07 Thread Steve
Ok, I think I see a light in the fog. It looks as if I can identify a variable to contain a library. Import datetime as dt1 I guess that I can have a second variable containing that same library: Import datetime as dt2 Should I presume that not doing this is what caused the interferen

Re: Questions about XML processing?

2020-11-07 Thread Dieter Maurer
Hernán De Angelis wrote at 2020-11-6 21:54 +0100: > ... >However, the hard thing to do here is to get those only when >tagC/note/title/string='value'. I was expecting to find a way of >specifying a certain construction in square brackets, like >[@string='value'] or [@/tagC/note/title/string='value'

Re: Is there a conflict of libraries here?

2020-11-07 Thread Peter J. Holzer
On 2020-11-07 13:26:30 -0500, Steve wrote: > Ok, I think I see a light in the fog. > > It looks as if I can identify a variable to contain a library. > > Import datetime as dt1 > > I guess that I can have a second variable containing that same library: > > Import datetime as dt2 > > Should I p

Re: Any better way for this removal? [typo correction]

2020-11-07 Thread Tim Chase
On 2020-11-07 10:51, Tim Chase wrote: > from string import ascii_lowercase > text = ",".join(ascii_lowercase) > to_throw_away = 5 [derp] For obvious reasons, these should be s/\/to_throw_away/g To throw away the trailing N delimited portions: > new_string = text.rsplit(',', n)[0] new

Re: Is there a conflict of libraries here?

2020-11-07 Thread Mats Wichmann
On 11/7/20 11:26 AM, Steve wrote: Ok, I think I see a light in the fog. It looks as if I can identify a variable to contain a library. Import datetime as dt1 I guess that I can have a second variable containing that same library: Import datetime as dt2 Should I presume that no

RE: Is there a conflict of libraries here?

2020-11-07 Thread Steve
Ok, the light just went out. I thought I was getting something, but no... I will keep on reading, maybe it will hatch. Maybe a different approach. What is happening here? (Should this be a new thread?) import tkinter as tk from tkinter import * from tkinter import ttk --