Re: beautifulSoup 4.1

2015-03-20 Thread Sayth
Thanks. I couldn't get that second text out. You can use the simpler css class selector I used before in bs4 after 4.1 . The longer version was used to overcome class clashing with the reserved keyword in previous versions. -- https://mail.python.org/mailman/listinfo/python-list

Re: Sudoku solver

2015-03-27 Thread Sayth
Good test for pypy to see where it's speed sits between C and Python. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 2/3 versus Perl 5/6

2015-03-28 Thread Sayth
Perl 6 tried to acheive to much, and by delay and confusion lost the enthusiasm of the community behind it Perl 6 and the at that time robust Perl 5 community who saw it as the future, when that future waned so did their's. Perl 6 should have just done what the community wanted at that time, in

Proposal for new minor syntax

2015-03-28 Thread Sayth
Sounds like you want to implement nim special dot syntax in python. http://nim-lang.org/manual.html#special-operators -- https://mail.python.org/mailman/listinfo/python-list

emacs for python web development

2015-04-04 Thread Sayth
Has anyone got a good configuration or advice for setting up a good python web development environment in emacs? Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: emacs for python web development

2015-04-04 Thread Sayth
Thanks, got the python bit down is just the Web for flask and django. Getting the templates and snippets to work in a good flow is where I am looking for advice. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

a python song - learning

2015-04-20 Thread Sayth
the knee bone is connected to the. .. ! Hit me with your best shot! Sayth -- https://mail.python.org/mailman/listinfo/python-list

Easy way to get a list of tuples.

2017-09-21 Thread Sayth Renshaw
this [('CLASS 3 HANDICAP', 1, 1000), ('BM 90 HANDICAP', 2, 1600), ('HERITAGE STAKES', 3, 1100), ('BILL RITCHIE HANDICAP', 4, 1400), ('TEA ROSE STAKES', 5, 1400), ('GEORGE MAIN STAKES', 6, 1600), ('THE SHORTS', 7, 1100), ('KINGTON TOWN STAKES', 8, 2000), ('BM 84 HANDICAP', 9, 1200)] I get close creating a list of elements but each attempt I try to create the list of tuples fails. This is my closest code data = r.json() raceData = [] for item in data["RaceDay"]['Meetings'][0]['Races']: raceDetails = item['RacingFormGuide']['Event']['Race'] raceData += (raceDetails['Name'],raceDetails['Number'],raceDetails['Distance']) print(raceDetails) which returns ['CLASS 3 HANDICAP', 1, 1000, 'BM 90 HANDICAP', 2, 1600, 'HERITAGE STAKES', 3, 1100, 'BILL RITCHIE HANDICAP', 4, 1400, 'TEA ROSE STAKES', 5, 1400, 'GEORGE MAIN STAKES', 6, 1600, 'THE SHORTS', 7, 1100, 'KINGTON TOWN STAKES', 8, 2000, 'BM 84 HANDICAP', 9, 1200] How do I get the tuples? Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Easy way to get a list of tuples.

2017-09-21 Thread Sayth Renshaw
On Thursday, 21 September 2017 20:31:28 UTC+10, Thomas Jollans wrote: > On 2017-09-21 12:18, Sayth Renshaw wrote: > > This is my closest code > > > > data = r.json() > > > > raceData = [] > > > > for item in data["RaceDay"]['Meeting

Re: Easy way to get a list of tuples.

2017-09-21 Thread Sayth Renshaw
> > > > Thanks Thomas yes you are right with append. I have tried it but just > > can't get it yet as append takes only 1 argument and I wish to give it 3. > > > You have not showed us what you tried, but you are probably missing a pair > of brackets. > > C:\Users\User>python > Python 3.6.0 (v

None is None but not working

2017-09-27 Thread Sayth Renshaw
print(data["RaceDay"]) and I get output of None None {'MeetingDate': '2017-01- ... and so on. How can I actually get this to check? If i use type(data) I also get None. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: None is None but not working

2017-09-28 Thread Sayth Renshaw
Thank you it was data["RaceDay"] that was needed. ata = r.json() if data["RaceDay"] is None: print("Nothing here") else: print(data["RaceDay"]) Nothing here Nothing here Nothing here {'MeetingDate': '2017-01-11T00:0

Suggestions on storing, caching, querying json

2017-10-04 Thread Sayth Renshaw
://objectpath.org/reference.html Looking to leverage your experience. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Suggestions on storing, caching, querying json

2017-10-06 Thread Sayth Renshaw
On Thursday, 5 October 2017 15:13:43 UTC+11, Sayth Renshaw wrote: > HI > > Looking for suggestions around json libraries. with Python. I am looking for > suggestions around a long term solution to store and query json documents > across many files. > > I will be

pathlib PurePosixPath

2017-10-10 Thread Sayth Renshaw
= r.json() if data["RaceDay"] is not None: file_name = data["RaceDay"]["Meetings"][0]["VenueName"] + data["RaceDay"]["MeetingDate"] + '.json' result_path = pathlib.PurePosixPath(r'C:\Users\Sa

Re: pathlib PurePosixPath

2017-10-10 Thread Sayth Renshaw
IX paths don't apply to your file > system, and... > > > OSError: [Errno 22] Invalid argument: > > 'C:\\Users\\Sayth\\Projects\\results/Warwick Farm2017-09-06T00:00:00.json' > > ... the colon is invalid on Windows file systems. You'll have to > replace those

Looping on a list in json

2017-11-04 Thread Sayth Renshaw
Hi I want to get a result from a largish json api. One section of the json structure returns lists of data. I am wanting to get each resulting list returned. This is my code. import json from pprint import pprint with open(r'/home/sayth/Projects/results/Canterbury_2017-01-20.json'

Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw
gt;import json > >from pprint import pprint > > > >with open(r'/home/sayth/Projects/results/Canterbury_2017-01-20.json', 'rb') > >as f, open('socks3.json','w') as outfile: > >to_read = json.load(f) > [...] > >me

Re: Read Firefox sqlite files with Python

2017-11-04 Thread Sayth Renshaw
e noise. > > > > > -- > Steve > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure > enough, things got worse. https://stackoverflow.com/a/18601429 Version mismatch between sqlite CLI and python sqlite API? I created again my db from the script ins

Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw
em in enumerate(result): # if this one is interested / not -filtered: print(n, item) runner_lists[n] = result["RacingFormGuide"]["Event"]["Runners"] ## Produces Traceback (most recent call last): dict_keys(['RaceDay', 'ErrorInfo', 'Success']) File "/home/sayth/PycharmProjects/ubet_api_mongo/parse_json.py", line 31, in runner_lists[n] = result["RacingFormGuide"]["Event"]["Runners"] TypeError: list indices must be integers or slices, not str Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw
Sorry figured it. Needed to use n to iterate when creating. runner_lists = {} for n, item in enumerate(result): # if this one is interested / not -filtered: print(n, item) runner_lists[n] = result[n]["RacingFormGuide"]["Event"]["R

Re: Looping on a list in json

2017-11-04 Thread Sayth Renshaw
sts = {} >for n, item in enumerate(result): ># if this one is interested / not -filtered: >print(n, item) >runner_lists[n] = result[n]["RacingFormGuide"]["Event"]["Runners"] Sayth -- https://mail.python.org/mailman/listinfo/python-list

generator function - Called and accepts XML attributes- Python 3.5

2016-09-10 Thread Sayth Renshaw
d return file when called Calling function to supply attributes """ for filename in sorted(file_list, *attribs): with open(dir_path + filename) as fd: doc = xmltodict.parse(fd.read()) for item in doc([attribs]): yield item Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: generator function - Called and accepts XML attributes- Python 3.5

2016-09-10 Thread Sayth Renshaw
ncern is that as some process in each table will be longish it is better to keep that separate and just call them from a main function. Maybe the generator should just stop at parsing the file at the root XML level so that each calling function can then hook up from its node. Is that clear or a massive brain dump? Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: generator function - Called and accepts XML attributes- Python 3.5

2016-09-10 Thread Sayth Renshaw
doc = xmltodict.parse(fd.read()) for item in doc['meeting']['race']: yield item my_generator = return_files(file_list) def gets_id(): for value in my_generator: for asset in value['nomination']: prin

strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
more explicitly states the intended type. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
t(v0 * t - 0.5 * g * t ** 2) elif int(answer) is True: raise ValueError("Ints aren't valid input") sys.exit() else: print("Ok please ammend your entries") Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: strings and ints consistency - isinstance

2016-09-21 Thread Sayth Renshaw
) is True: print(v0 * t - 0.5 * g * t ** 2) else: print("Ok please ammend your entries") Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Data Types

2016-09-21 Thread Sayth Renshaw
t be thought of as some alternative value which is a bool, any > more than we should think of 1+1 as being a different value to 2. > > What about 0 or 1 they are true and false like no other numbers? what category do they fall in with regards to booleans? In [6]: 0 == False Out[6]:

Re: strings and ints consistency - isinstance

2016-09-22 Thread Sayth Renshaw
approaches I have seen in trying to get this to work. Half opt for try except the other half if else and then implement them largely differently. Every many and varied approach str2bool(), isalpha() using list with isinstance(var, [ int, str, bool]) etc. Anyway back to the old drawing board. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

how to append to list in list comprehension

2016-09-30 Thread Sayth Renshaw
ups. p = re.compile('\d+') fups = p.findall(nomattr['firstup']) [x[4] for x in fups if IndexError fups.append(0)] print(fups) Unsure why I cannot use append in this instance, how can I modify to acheive desired output? Desired Output ['0', '0', '0', '0', '0'] ['0', '0', '0', '0', '0'] ['0', '0', '0', '0', '0'] ['0', '0', '0', '0', '0'] ['0', '0', '0', '0', '0'] ['0', '0', '0', '0', '0'] ['7', '2', '1', '0', '142647', '00'] ['7', '2', '0', '1', '87080', '00'] ['6', '1', '1', '1', '51700', '00'] ['4', '1', '1', '0', '36396', '00'] Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: how to append to list in list comprehension

2016-09-30 Thread Sayth Renshaw
ts fail it. I do like [(f + ['0'] if len(f) < 5 else f) for f in fups ] Rustom, if there are better non list comprehension options I would like to know as generally I find then confusing. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: how to append to list in list comprehension

2016-09-30 Thread Sayth Renshaw
On Saturday, 1 October 2016 14:17:06 UTC+10, Rustom Mody wrote: > On Saturday, October 1, 2016 at 9:08:09 AM UTC+5:30, Sayth Renshaw wrote: > > I do like [(f + ['0'] if len(f) < 5 else f) for f in fups ] Rustom, if > > there are better non list comprehension opt

Re: how to append to list in list comprehension

2016-09-30 Thread Sayth Renshaw
On Saturday, 1 October 2016 14:17:06 UTC+10, Rustom Mody wrote: > On Saturday, October 1, 2016 at 9:08:09 AM UTC+5:30, Sayth Renshaw wrote: > > I do like [(f + ['0'] if len(f) < 5 else f) for f in fups ] Rustom, if > > there are better non list comprehension opt

generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
Evening My file list handler I have created a generator. Before I created it as a generator I was able to use iter on my lxml root objects, now I cannot iter. ± |master U:2 ?:1 ✗| → python3 race.py data/ -e *.xml Traceback (most recent call last): File "race.py", line 83, in dataAttr(roo

Re: rocket simulation game with just using tkinter

2016-10-01 Thread Sayth Renshaw
o you just need python 2/3 with tkinter to play this! > > > Have fun > Irmen Well done. An interesting listen that might be up your alley, how-i-built-an-entire-game-and-toolchain-100-in-python on talkpython https://talkpython.fm/episodes/show/78/how-i-built-an-entire-game-and-toolchain-100-in-python Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
My main issue is that usually its just x in ,,, for a generator. But if I change the code for meet in roots.iter("meeting"): to for meet in roots("meeting"): Well its invalid but I need to be able to reference the node, how do I achieve this? Sayth -- https://mail.python.

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
call last): File "race.py", line 77, in dataAttr(rootObs) File "race.py", line 55, in dataAttr for meet in roots.iter("meeting"): AttributeError: 'generator' object has no attribute 'iter' Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: RASTER analysis(slope)

2016-10-01 Thread Sayth Renshaw
df from scipy conference. https://conference.scipy.org/proceedings/scipy2015/pdfs/mattheus_ueckermann.pdf Sayth -- https://mail.python.org/mailman/listinfo/python-list

inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
Hi I have a fileobject which was fine however now I want to delete a line from the file object before yielding. def return_files(file_list): for filename in sorted(file_list): with open(dir_path + filename) as fd: for fileItem in fd: yield fileItem Ned

Re: inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
Thank you -- https://mail.python.org/mailman/listinfo/python-list

Re: inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
On Sunday, 2 October 2016 12:14:43 UTC+11, MRAB wrote: > On 2016-10-02 01:21, Sayth Renshaw wrote: > > Hi > > > > I have a fileobject which was fine however now I want to delete a line from > > the file object before yielding. > > > > def return_files(fil

Re: inplace text filter - without writing file

2016-10-01 Thread Sayth Renshaw
On Sunday, 2 October 2016 16:19:14 UTC+11, Sayth Renshaw wrote: > On Sunday, 2 October 2016 12:14:43 UTC+11, MRAB wrote: > > On 2016-10-02 01:21, Sayth Renshaw wrote: > > > Hi > > > > > > I have a fileobject which was fine however now I want to delete a lin

Create a map for data to flow through

2016-10-02 Thread Sayth Renshaw
harder to manage. I am reading here https://docs.python.org/3/howto/functional.html Is there a better way than loops on loops on loops etc? Thinking that for loop is quick at the start but there probably is a more direct way which while slower may be clearer over the long run. Cheers Sayth

scipy tutorial question

2016-10-02 Thread Sayth Renshaw
I would ask on scipy mailing list as it may provide a better response. https://www.scipy.org/scipylib/mailing-lists.html Sayth -- https://mail.python.org/mailman/listinfo/python-list

lxml ignore none in getchildren

2016-10-04 Thread Sayth Renshaw
one matches, how can I ignore nones? In [2]: from lxml import etree In [3]: xml = ''' ''' In [4]: pen =etree.fromstring(xml) In [5]: pencontents = pen.getchildren() In [6]: for content in pencontents: ...: print(content.get('n')) 2 Non

Generator comprehension - list None

2016-10-18 Thread Sayth Renshaw
num in enumerate(range(10))) # for item in a: # print(item) b = list(a) print(b) Output Got 0 Got 1 Got 2 Got 3 Got 4 Got 5 Got 6 Got 7 Got 8 Got 9 [None, None, None, None, None, None, None, None, None, None] => None Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Generator comprehension - list None

2016-10-18 Thread Sayth Renshaw
Thank you quite easy, was trying to work around it in the generator, the print needs to be outside the generator to avoid the collection of "None". Wasn't really liking comprehensions though python 3 dict comprehensions are a really nice utility. Sayth -- https://mail.pyt

Re: need help for an assignment plz noob here

2016-10-18 Thread Sayth Renshaw
holding different information. To construct the new tuple, it is convenient that we can slice parts of the old tuple and join up the bits to make the new tuple. So if julia has a new recent film, we could change her variable to reference a new tuple that used some information from the old

Inplace shuffle function returns none

2016-10-18 Thread Sayth Renshaw
e object that b becomes. So how do i get shuffle to give me my numbers? Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Inplace shuffle function returns none

2016-10-18 Thread Sayth Renshaw
So why can't i assign the result slice to a variable b? It just keeps getting none. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Inplace shuffle function returns none

2016-10-19 Thread Sayth Renshaw
Ok i think i do understand it. I searched the python document for in-place functions but couldn't find a specific reference. Is there a particular part in docs or blog that covers it? Or is it fundamental to all so not explicitly treated in one particular page? Thanks Sayth --

Re: Inplace shuffle function returns none

2016-10-19 Thread Sayth Renshaw
Hi Chris I read this last night and thought i may have woken with a frightfully witty response. I didnt however. Thanks :-) -- https://mail.python.org/mailman/listinfo/python-list

Re: HTML templating tools

2016-10-21 Thread Sayth Renshaw
ypants.py version for python, however I will show you one I like mainly because I don't like jinja and it seems more stylish and clear to me. not on many wiki's yet but should be is a python port of jade which I think is probably the best template language. https://github.com/syrus

windows utf8 & lxml

2016-12-20 Thread Sayth Renshaw
this SO for http://stackoverflow.com/a/29217546/461887 but cannot seem to implement with lxml. Ideas? Sayth -- https://mail.python.org/mailman/listinfo/python-list

windows utf8 & lxml

2016-12-20 Thread Sayth Renshaw
Possibly i will have to use a different method from lxml like this. http://stackoverflow.com/a/29057244/461887 Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: windows utf8 & lxml

2016-12-21 Thread Sayth Renshaw
On Tuesday, 20 December 2016 22:54:03 UTC+11, Sayth Renshaw wrote: > Hi > > I have been trying to get a script to work on windows that works on mint. The > key blocker has been utf8 errors, most of which I have solved. > > Now however the last error I am trying to over

for loop iter next if file bad

2016-12-21 Thread Sayth Renshaw
""" for file in file_list: with open(os.path.join(dir_path, file), 'rb') as fd: if os.stat(fd.name).st_size == 0: next(file) else: yield fd Exact error is: C:\Users\Sayth\Anaconda3\envs\race\python.exe C:/Use

Re: for loop iter next if file bad

2016-12-21 Thread Sayth Renshaw
and moves the control back to the top of the loop. The continue statement can be used in both while and for loops. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Screwing Up looping in Generator

2017-01-03 Thread Sayth Renshaw
[meet_id, meet_venue, meet_date, ... #parsing info removed noms.get("jockeyfirstname")]) Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-03 Thread Sayth Renshaw
quot;) with open(write_to, 'w', newline='') as csvf: for file in rootobs: # create and write csv Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-03 Thread Sayth Renshaw
On Wednesday, 4 January 2017 12:36:10 UTC+11, Sayth Renshaw wrote: > So can I call the generator twice and receive the same file twice in 2 for > loops? > > Once to get the files name and the second to process? > > for file in rootobs: > base = os.pa

Re: Screwing Up looping in Generator

2017-01-03 Thread Sayth Renshaw
newline='') as csvf: for file in rootobs: # create and write csv Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-04 Thread Sayth Renshaw
race_writer = csv.writer(csvf, delimiter=',' ) thanks for your time and assistance. It's much appreciated Sayth -- https://mail.python.org/mailman/listinfo/python-list

Is there a good process or library for validating changes to XML format?

2017-01-04 Thread Sayth Renshaw
lt for PyXB and generateDS (https://pythonhosted.org/generateDS/). Both seem to be libraries for generating bindings to structures for parsing so maybe I am searching the wrong thing. What is the right thing to search? Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a good process or library for validating changes to XML format?

2017-01-05 Thread Sayth Renshaw
It definitely has more features than i knew http://xmlsoft.org/xmllint.html Essentially thigh it appears to be aimed at checking validity and compliance of xml. I why to check the structure of 1 xml file against the previous known structure to ensure there are no changes. Cheers Sayth

Re: Screwing Up looping in Generator

2017-01-06 Thread Sayth Renshaw
On Wednesday, 4 January 2017 12:36:10 UTC+11, Sayth Renshaw wrote: > So can I call the generator twice and receive the same file twice in 2 for loops? > > Once to get the files name and the second to process? > > for file in rootobs: > base = os.path.

Re: Screwing Up looping in Generator

2017-01-06 Thread Sayth Renshaw
") with open(write_to, 'w', newline='') as csvf: for file in rootobs: # create and write csv Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-06 Thread Sayth Renshaw
x27;) as csvf: for file in rootobs: # create and write csv Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Screwing Up looping in Generator

2017-01-06 Thread Sayth Renshaw
race_writer = csv.writer(csvf, delimiter=',' ) thanks for your time and assistance. It's much appreciated Sayth -- https://mail.python.org/mailman/listinfo/python-list

Is there a good process or library for validating changes to XML format

2017-01-06 Thread Sayth Renshaw
lt for PyXB and generateDS (https://pythonhosted.org/generateDS/). Both seem to be libraries for generating bindings to structures for parsing so maybe I am searching the wrong thing. What is the right thing to search? Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Data Integrity Parsing json

2018-04-25 Thread Sayth Renshaw
On Thursday, 26 April 2018 07:57:28 UTC+10, Paul Rubin wrote: > Sayth Renshaw writes: > > What I am trying to figure out is how I give myself surety that the > > data I parse out is correct or will fail in an expected way. > > JSON is messier than people think. Here&#

Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
ssDiv', 'GlossList', 'GlossEntry', 'GlossDef', 'GlossSeeAlso', 0], ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossDef', 'GlossSeeAlso', 1], ['glossary', 'GlossDiv', 'GlossList', 'GlossEntry', 'GlossSee']] I am trying to change it to be. [['glossary'], ['glossary']['title'], ['glossary']['GlossDiv'], ] Currently when I am formatting I am flattening the structure(accidentally). for item in data: for elem in item: out = ("[{0}]").format(elem) print(out) Which gives [glossary] [title] [GlossDiv] [title] [GlossList] [GlossEntry] [ID] [SortAs] [GlossTerm] [Acronym] [Abbrev] [GlossDef] [para] [GlossSeeAlso] [0] [1] [GlossSee] Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
out) print(answer) Think I need to bring it in a list not an element of a list and process it. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
lossary]', '[GlossDiv]', '[GlossList]'], ['[glossary]', '[GlossDiv]', '[GlossList]', '[GlossEntry]'], .] I used. elements = [['[{0}]'.format(element) for element in elements]for elements in data] Is there a good way to s

Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
On Tuesday, 24 July 2018 14:25:48 UTC+10, Rick Johnson wrote: > Sayth Renshaw wrote: > > > elements = [['[{0}]'.format(element) for element in elements]for elements > > in data] > > I would suggest you avoid list comprehensions until you master long-form &g

Re: Format list of list sub elements keeping structure.

2018-07-23 Thread Sayth Renshaw
On Tuesday, 24 July 2018 14:25:48 UTC+10, Rick Johnson wrote: > Sayth Renshaw wrote: > > > elements = [['[{0}]'.format(element) for element in elements]for elements > > in data] > > I would suggest you avoid list comprehensions until you master long-form &g

Re: Format list of list sub elements keeping structure.

2018-07-24 Thread Sayth Renshaw
on 3 import operator def getFromDict(dataDict, mapList): return reduce(operator.getitem, mapList, dataDict) def setInDict(dataDict, mapList, value): getFromDict(dataDict, mapList[:-1])[mapList[-1]] = value Then get the values from the keys >>> getFromDict(dataDict, ["a", "r"]) 1 That would mean I could using my function if I get it write be able to feed it any json, get all the full paths nicely printed and then feed it back to the SO formula and get the values. It would essentially self process itself and let me get a summary of all keys and their data. Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Format list of list sub elements keeping structure.

2018-07-24 Thread Sayth Renshaw
ving to figure out the structure each time. Just want to automate that part so I can move through the munging part and spend more time on higher value tasks. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Format list of list sub elements keeping structure.

2018-07-24 Thread Sayth Renshaw
solve each small part, and > (3) assemble the whole puzzle. This is a skill you must > master. And it's really not difficult. It just requires a > different way of thinking about tasks. Thank you Rick, good advice. I really am enjoying coding at the moment, got myself and life in a good headspace. Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Use a function arg in soup

2018-08-01 Thread Sayth Renshaw
deas on how the function argument can be used as the search attribute? Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Use a function arg in soup

2018-08-01 Thread Sayth Renshaw
Sayth -- https://mail.python.org/mailman/listinfo/python-list

Advice on Python build tools

2016-04-12 Thread Sayth Renshaw
so being able to have mixed js and python support would be needed. Thoughts? Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: Anyone here use the ConEmu console app?

2016-04-12 Thread Sayth Renshaw
Win 10 will have full bash provided by project between Ubuntu and MS so that's pretty cool Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: Advice on Python build tools

2016-04-12 Thread Sayth Renshaw
On Tuesday, 12 April 2016 19:48:43 UTC+10, Sayth Renshaw wrote: > Hi > > Looking at the wiki list of build tools > https://wiki.python.org/moin/ConfigurationAndBuildTools > > Has anyone much experience in build tools as i have no preference or > experience to lean on.

Re: Advice on Python build tools

2016-04-14 Thread Sayth Renshaw
so much clearer. Anyway checked out mako which has some improvement might see if there is another with support and create a nikola plugin and then give it a try. Cheers Sayth On Thu, 14 Apr 2016 1:19 am Chris Warrick wrote: > On 12 April 2016 at 11:48, Sayth Renshaw wrote: >

Create a forecast estimate updated with actuals weekly

2016-04-14 Thread Sayth Renshaw
9 So doing it manually I would discover Bill needs 6 out of 9 each week, which results in: sumget 28 0.6 result sumopp 45 But how do I structure this so that the new results when known for week 3 update and adjust the following estimates? Thanks Sayth

What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
))] horseName = [res.eq(i).attr('horse') for i in range(len(res))] print(nomID, horseName) comes out correctly In [7]: 171115 Vergara Since I will be taking another 10 attributes out of nominmation category an efficient way that ensures data integrity would be valued. Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw wrote: > Hi > > I have an XML and using pyquery to obtain the elements within it and then > write it to csv. > > What is the best most reliable way to take dictionaries of each element, and > print them(csv write

Re: What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 12:12:59 UTC+10, Sayth Renshaw wrote: > On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw wrote: > > Hi > > > > I have an XML and using pyquery to obtain the elements within it and then > > write it to csv. > > > > Wha

Re: What iterable method should I use for Lists of Lists

2016-04-17 Thread Sayth Renshaw
On Monday, 18 April 2016 13:13:21 UTC+10, Sayth Renshaw wrote: > On Monday, 18 April 2016 12:12:59 UTC+10, Sayth Renshaw wrote: > > On Monday, 18 April 2016 12:05:39 UTC+10, Sayth Renshaw wrote: > > > Hi > > > > > > I have an XML and using pyquery to ob

Re: scipy install error,need help its important

2016-04-17 Thread Sayth Renshaw
d --compile" failed with error code 1 in > c:\users\name\appdata\local\temp\pip-build-a3fjaf\scipy\ Either install and use anaconda https://www.continuum.io/downloads or use these builds to install. http://www.lfd.uci.edu/~gohlke/pythonlibs/ Cheers Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: scipy install error,need help its important

2016-04-17 Thread Sayth Renshaw
-compile" failed with error code 1 in > c:\users\name\appdata\local\temp\pip-build-a3fjaf\scipy\ Oh and I would choose the anaconda route. Then you can use conda to easy manage libraries that could otherwise be dificult on windows. Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: What iterable method should I use for Lists of Lists

2016-04-18 Thread Sayth Renshaw
en thought of another resource and kept reading. I have a working messy solution hopefully I can resolve it to something nicer. Sayth -- https://mail.python.org/mailman/listinfo/python-list

How to track files processed

2016-04-18 Thread Sayth Renshaw
Hi If you are parsing files in a directory what is the best way to record which files were actioned? So that if i re-parse the directory i only parse the new files in the directory? Thanks Sayth -- https://mail.python.org/mailman/listinfo/python-list

Re: How to track files processed

2016-04-18 Thread Sayth Renshaw
Thank you Martin and Peter To clarify Peter at the moment only writing to csv but am wanting to set up an item pipeline to SQL db next. I will have a go at your examples Martin and see how i go. Thank you both for taking time to help. Sayth -- https://mail.python.org/mailman/listinfo/python

Why are my files in in my list - os module used with sys argv

2016-04-18 Thread Sayth Renshaw
7;) frames = pd.DataFrame(data) print(frames) I am running this from the bash prompt as (pyquery)sayth@sayth-E6410:~/Projects/pyquery$ python jqxml.py samples *.xml my directory structure (pyquery)sayth@sayth-E6410:~/Projects/pyquery$ ls -a . .. environment.yml .git .gitignore #jqxml.py#

Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Sayth Renshaw
On Tuesday, 19 April 2016 18:17:02 UTC+10, Peter Otten wrote: > Steven D'Aprano wrote: > > > On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote: > > > >> Hi > >> > >> Why would it be that my files are not being found in this script? > &g

Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Sayth Renshaw
On Tuesday, 19 April 2016 23:21:42 UTC+10, Sayth Renshaw wrote: > On Tuesday, 19 April 2016 18:17:02 UTC+10, Peter Otten wrote: > > Steven D'Aprano wrote: > > > > > On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote: > > > > > >> Hi > >

Re: Why are my files in in my list - os module used with sys argv

2016-04-19 Thread Sayth Renshaw
On Tuesday, 19 April 2016 23:46:01 UTC+10, Peter Otten wrote: > Sayth Renshaw wrote: > > > Thanks for the insight, after doing a little reading I found this post > > which uses both argparse and glob and attempts to cover the windows and > > bash expansio

  1   2   3   >