On Wednesday, 11 September 2019 20:25:32 UTC+10, Sayth Renshaw wrote:
> On Wednesday, 11 September 2019 20:11:21 UTC+10, Sayth Renshaw wrote:
> > Hi
> >
> > I want to allow as many lists as needed to be passed into a function.
> > But how can I determine how
On Wednesday, 11 September 2019 20:11:21 UTC+10, Sayth Renshaw wrote:
> Hi
>
> I want to allow as many lists as needed to be passed into a function.
> But how can I determine how many lists have been passed in?
>
> I expected this to return 3 but it only returned 1.
>
>
Hi
I want to allow as many lists as needed to be passed into a function.
But how can I determine how many lists have been passed in?
I expected this to return 3 but it only returned 1.
matrix1 = [[1, -2], [-3, 4],]
matrix2 = [[2, -1], [0, -1]]
matrix3 = [[2, -1], [0, -1]]
# print(add(matrix1,
On Tuesday, 10 September 2019 12:56:36 UTC+10, Sayth Renshaw wrote:
> On Friday, 6 September 2019 07:52:56 UTC+10, Piet van Oostrum wrote:
> > Piet van Oostrum <> writes:
> >
> > > That would select ROWS 0,1,5,6,7, not columns.
> > > To select columns
On Friday, 6 September 2019 07:52:56 UTC+10, Piet van Oostrum wrote:
> Piet van Oostrum <> writes:
>
> > That would select ROWS 0,1,5,6,7, not columns.
> > To select columns 0,1,5,6,7, use two-dimensional indexes
> >
> > df1 = df.iloc[:, [0,1,5,6,7]]
> >
> > : selects all rows.
>
> And that
That is actually consistent with Excel row, column. Can see why it works that
way then.
Thanks
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, 1 September 2019 10:48:54 UTC+10, Sayth Renshaw wrote:
> I've created a share doc same structure anon data from my google drive.
>
> https://drive.google.com/file/d/0B28JfFTPNr_lckxQRnFTRF9UTEFYRUVqRWxCNVd1VEZhcVNr/view?usp=sharing
>
> Sayth
I tried creating th
On Monday, 2 September 2019 04:44:29 UTC+10, YuXuan Dong wrote:
> Hi, everybody:
>
> I have met a problem while I ran `python setup.py test`:
>
> unittest.case.SkipTest: No module named 'winreg'
>
> I ran the command in MacOS and my project is written for only UNIX-like
> systems. I
On Monday, 2 September 2019 06:02:58 UTC+10, Spencer Du wrote:
> Hi
>
> I have code for GUI and MQTT. In GUI.py I have "def loadGUI" which loads up a
> GUI file if the file exists in current directory. I want to add the file name
> to a list when a file is imported and for each subsequent
I've created a share doc same structure anon data from my google drive.
https://drive.google.com/file/d/0B28JfFTPNr_lckxQRnFTRF9UTEFYRUVqRWxCNVd1VEZhcVNr/view?usp=sharing
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, 1 September 2019 05:19:34 UTC+10, Piet van Oostrum wrote:
> Sayth Renshaw writes:
>
> > But on both occasions I receive this error.
> >
> > # KeyError: 'the label [Current Team] is not in the [index]'
> >
> > if I test df1 before trying to crea
On Friday, 30 August 2019 00:49:32 UTC+10, Piet van Oostrum wrote:
> Piet van Oostrum writes:
>
> > So the correct way to do this is to make df1 a copy rather than a view.
> >
> > df1 = df.loc[:, ('UID','Name','New Leader','Current Team', 'New Team')]
>
> Or maybe even make an explicit copy:
>
On Thursday, 29 August 2019 20:33:46 UTC+10, Peter Otten wrote:
> Sayth Renshaw wrote:
>
> > will find the added
> > pairs, but ignore the removed ones. Is that what you want?
> >
> > Yes, I think. I want to find the changed pairs. The people that moved team
> &
On Friday, 30 August 2019 00:49:32 UTC+10, Piet van Oostrum wrote:
> Piet van Oostrum
>
> > So the correct way to do this is to make df1 a copy rather than a view.
> >
> > df1 = df.loc[:, ('UID','Name','New Leader','Current Team', 'New Team')]
>
> Or maybe even make an explicit copy:
>
> df1
will find the added
pairs, but ignore the removed ones. Is that what you want?
Yes, I think. I want to find the changed pairs. The people that moved team
numbers.
Sayth
--
https://mail.python.org/mailman/listinfo/python-list
Hi
I am importing 4 columns into a dataframe from a spreadsheet.
My goal is to create a 5th column with TRUE or False if column 4 (str) matches
column 3.
Trying to leverage this answer https://stackoverflow.com/a/35940955/461887
This is my code
import pandas as pd
xls =
On Thursday, 29 August 2019 14:03:44 UTC+10, Sayth Renshaw wrote:
> On Thursday, 29 August 2019 13:53:43 UTC+10, Sayth Renshaw wrote:
> > On Thursday, 29 August 2019 13:25:01 UTC+10, Sayth Renshaw wrote:
> > > Hi
> > >
> > > Trying to find whats change
On Thursday, 29 August 2019 13:53:43 UTC+10, Sayth Renshaw wrote:
> On Thursday, 29 August 2019 13:25:01 UTC+10, Sayth Renshaw wrote:
> > Hi
> >
> > Trying to find whats changed in this example. Based around work and team
> > reschuffles.
> >
> &
On Thursday, 29 August 2019 13:25:01 UTC+10, Sayth Renshaw wrote:
> Hi
>
> Trying to find whats changed in this example. Based around work and team
> reschuffles.
>
> So first I created my current teams and then my shuffled teams.
>
> people = ["Tim","
>
> A site like http://www.pyregex.com/ allows you to check your regex with
> slightly fewer clicks and keystrokes than editing your program.
Thanks Jason
--
https://mail.python.org/mailman/listinfo/python-list
Hi
Trying to find whats changed in this example. Based around work and team
reschuffles.
So first I created my current teams and then my shuffled teams.
people = ["Tim","Bill","Sally","Ally","Fred","Fredricka"]
team_number = [1,1,2,2,3,3]
shuffle_people =
On Wednesday, 21 August 2019 03:16:01 UTC+10, Ian wrote:
> Or use the "pairwise" recipe from the itertools docs:
>
> from itertools import tee
>
> def pairwise(iterable):
> "s -> (s0,s1), (s1,s2), (s2, s3), ..."
> a, b = tee(iterable)
> next(b, None)
> return zip(a, b)
>
> for
Hi
I want to do basic math with a list.
a = [1, 2, 3, 4, 5, 6, 7, 8]
for idx, num in enumerate(a):
print(idx, num)
This works, but say I want to print the item value at the next index as well as
the current.
for idx, num in enumerate(a):
print(num[idx + 1], num)
I am expecting 2,
Cecil Westerhof wrote:
> I was asked to copy a certain line from about 300 Excel lines to a new
> Excel file. That is not something I would like to do by hand and I
> immediately thought: that should be possible with Python.
>
> And it is. I was surprised how fast I could write that with
Chris Roberts wrote:
> ###
> CODE:
>elif line1.rstrip(‘\n’) in line2.strip(‘\n’):
>for line3 in myips:
>print “###”
>print “line1 is %s” % line1.rstrip(‘\n’)
>print “line2 is %s” % line2.strip(‘\n’)
> ###
>
>
> Since I didn't find a cool shortcut I decided to use brute force:
>
> $ cat pandas_explode_column.py
> import pandas as pd
>
> df = pd.DataFrame(
> [
> [
> "2019-06-21 11:15:00",
> "WNEWSKI, Joan;#17226;#BALIN, Jock;#18139;#DUNE, Colem;#17230;"
>
Update.
Option 1. - This annihilates all text in the column leaving nothing.
completed_tasks['Consultant'] =
completed_tasks['Consultant'].str.rstrip('.#123')
Option 2. - returns unhashable series list.
output =
completed_tasks[completed_tasks['Consultant']].str.contains(r'/\b[^\d\W]+\b/g')
> > NB. There are varied amounts of consultants so splitting across columns is
> > uneven. if it was even melt seems like it would be good
> > https://dfrieds.com/data-analysis/melt-unpivot-python-pandas
>
> Keep it simple: https://docs.python.org/3.6/library/string.html
>
> --
> Regards
Hi
Having fun with pandas filtering a work excel file.
My current script opens selected and filters the data and saves as excel.
import pandas as pd
import numpy as np
log = pd.read_excel("log_dump_py.xlsx")
df = log.filter(items=['Completed', 'Priority', 'Session date', 'Consultant',
> To get the individual lines you have to yield them
>
> for line in lines_gen:
> yield line
>
> This can be rewritten with some syntactic sugar as
>
> yield from lines_gen
>
> > for line in getWord(fileName, 5):
> > with open(dumpName, 'a') as f:
> >
Afternoon
Trying to create a generator to write the first N lines of text to a file.
However, I keep receiving the islice object not the text, why?
from itertools import islice
fileName = dir / "7oldsamr.txt"
dumpName = dir / "dump.txt"
def getWord(infile, lineNum):
with open(infile, 'r+')
> Now, what happens when the code is tested with various (different) sets
> of test-data?
> (remember the last question from my previous msg!?)
>
It fails on any list entry that isn't a float or an int, giving a TypeError.
> Once you are happy with the various test-runs, do you have any ideas
On Friday, 19 April 2019 17:01:33 UTC+10, Sayth Renshaw wrote:
> Set the first item in the list as the current largest.
> Compare each subsequent integer to the first.
> if this element is larger, set integer.
def maxitwo(listarg):
myMax = listarg[0]
Set the first item in the list as the current largest.
Compare each subsequent integer to the first.
if this element is larger, set integer.
--
https://mail.python.org/mailman/listinfo/python-list
>
> In English rather than Python, how do you find the maximum element in a
> list?
>
> --
> Rob Gaddi, Highland Technology
Get first 1 item in the list and compare it to the rest. If it is larger than
rest its the max. However if another list member is larger it replaces the
first item
> >
> It's still overly complicated.
>
This is where I have ended up. Without itertools and max its what I got
currently.
def maximum(listarg):
myMax = listarg[0]
for item in listarg:
for i in listarg[listarg.index(item)+1:len(listarg)]:
if myMax < i:
Thank you for the advice everyone.
>
> The first thing to try is find every place where you update myMax, and
This was actually where I was going wrong. I was setting max but then
overwriting it with item. Then kept checking item only to return myMax.
I went looking for other solutions as I
wrote:
> >
> >
> > I have created a function that takes a list as an argument.
> > Without using itertools I want to compare each item in the list to find the
> > max.
> >
> > However instead of the max I keep getting the last item in the list. Where
> > is my logic wrong here?
> >
> > def
On Thursday, 18 April 2019 06:59:43 UTC+10, Rich Shepard wrote:
> What is the proper syntax to import the model class in the model/
> subdirectory into a tkinter view module, e.g., activities.py? The syntax,
> 'import model as m' fails because it is not in the same subdirectory as the
> importing
I have created a function that takes a list as an argument.
Without using itertools I want to compare each item in the list to find the max.
However instead of the max I keep getting the last item in the list. Where is
my logic wrong here?
def maximum(listarg):
items = list(listarg)
On Saturday, 6 April 2019 08:21:51 UTC+11, maak khan wrote:
> i need your help guys .. plz
With?
--
https://mail.python.org/mailman/listinfo/python-list
Wow in both of these examples I have no idea what is happening. Enjoying trying
to figure it out :-)
> print(*[[n,"Fizz","Buzz","Fizzbuzz"][int("300102100120100"[n%15])] for
> n in range(1,101)], sep="\n")
> This is not good code, and if anyone asks, I didn't say you were
> allowed to do
I saw this fizzbuzz in Eloquent Javascript and thought its really nice. Not all
the usual if else version, just if.
for (let n = 1; n <= 100; n++) {
let output = "";
if (n % 3 == 0) output += "Fizz";
if (n % 5 == 0) output += "Buzz";
console.log(output || n);
}
I can't quite get a nice
On Thursday, 4 April 2019 10:51:35 UTC+11, Paul Rubin wrote:
> Sayth Renshaw writes:
> > for x in range ( max_root ):
> > 1) Do you see a memory bottleneck here? If so, what is it?
> > 2) Can you think of a way to fix the memory bottleneck?
>
> In Python 2, range(
In an email, I received this question as part of a newsletter.
def fetch_squares ( max_root ):
squares = []
for x in range ( max_root ):
squares . append (x **2)
return squares
MAX = 5
for square in fetch_squares (MAX ):
do_something_with ( square )
1) Do you see a
On Sunday, 3 February 2019 14:31:14 UTC+11, Avi Gross wrote:
> Yes, you caught the usual flaw in the often irregular English language.
>
> The 11th, 12th and 13th do all begin with 1 so there is a simple fix in the
> function version by checking if day//10 is 1.
>
> Revised example:
>
> """
> >I am trying to convert a switch statement from C into Python. (why?
> >practising).
> >
> >This is the C code.
> >
> >printf("Dated this %d", day);
> > switch (day) {
> >case 1: case 21: case 31:
> >printf("st"); break;
> >case 2: case 22:
> >printf("nd"); break;
> >
Hi
I am trying to convert a switch statement from C into Python. (why? practising).
This is the C code.
printf("Dated this %d", day);
switch (day) {
case 1: case 21: case 31:
printf("st"); break;
case 2: case 22:
printf("nd"); break;
case 3: case 23:
Thanks Peter
###
(2) attrs is a dict, so iterating over it will lose the values. Are you sure
you want that?
###
Yes initially I want just the keys as a list so I can choose to filter them out
to only the ones I want.
# getAttr
Thanks very much will get my function up and working.
Cheers
Hi.
I want to use a function argument as an argument to a bs4 search for attributes.
I had this working not as a function
# noms = soup.findAll('nomination')
# nom_attrs = []
# for attr in soup.nomination.attrs:
# nom_attrs.append(attr)
But as I wanted to keep finding other
>
> Well, your code was close. All you needed was a little tweak
> to make it work like you requested. So keep working at it,
> and if you have a specific question, feel free to ask on the
> list.
>
> Here's a tip. Try to simplify the problem. Instead of
> looping over a list of lists, and then
> > Then using this cool answer on SO [...]
>
> Oh. I thought you wanted to learn how to solve problems. I had no idea you
> were auditioning for the James Dean part. My bad.
Awesome response burn lol.
I am trying to solve problems. Getting tired of dealing with JSON and having to
figure
> myjson = ...
> path = "['foo']['bar'][42]"
> print(eval("myjson" + path))
>
> ?
>
> Wouldn't it be better to keep 'data' as is and use a helper function like
>
> def get_value(myjson, path):
> for key_or_index in path:
> myjson = myjson[key_or_index]
> return myjson
>
>
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
> loops.
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
> loops.
I am very close to the end result. I now have it as
Output
[ ['[glossary]'],
['[glossary]', '[title]'],
['[glossary]', '[GlossDiv]'],
['[glossary]', '[GlossDiv]', '[title]'],
['[glossary]', '[GlossDiv]', '[GlossList]'],
['[glossary]', '[GlossDiv]', '[GlossList]',
> >
> > for item in data:
> > for elem in item:
> > out = ("[{0}]").format(elem)
> > print(out)
>
> Hint: print implicitly adds a newline to the output string. So collect all
> the values of each sublist and print a line-at-time to output, or use the
> end= argument of Py3's
I have data which is a list of lists of all the full paths in a json document.
How can I change the format to be usable when selecting elements?
data = [['glossary'],
['glossary', 'title'],
['glossary', 'GlossDiv'],
['glossary', 'GlossDiv', 'title'],
['glossary', 'GlossDiv', 'GlossList'],
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's
no doubt tho after playing with this is that enumerate value ends up in the
output which is a dictionary. The enumerate has no key which makes it invalid
json if dumped.
Not massive issue but getting the effect of enumerate without polluting output
would be the winner.
>runner_lists = {}
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"]["Runners"]
Sayth
--
> I'd just keep the interesting runners, along with their race numbers, in a
> dict. The enumerate function is handy here. Something like (untested):
>
> runner_lists = {}
> for n, item in enumerate(result):
> if this one is interested/not-filtered:
> runner_lists[n] =
On Sunday, 5 November 2017 04:32:26 UTC+11, Steve D'Aprano wrote:
> I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.
>
>
> import sqlite3
> con = sqlite3.connect('foo.sqlite')
> with open('dump.sql', 'w') as f:
> for line in con.iterdump():
> f.write(line +
On Sunday, 5 November 2017 09:53:37 UTC+11, Cameron Simpson wrote:
> >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
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', 'rb') as
> > Hi
> >
> > How do I create a valid file name and directory with pathlib?
> >
> > When I create it using PurePosixPath I end up with an OSError due to an
> > obvously invlaid path being created.
>
> You're on Windows. The rules for POSIX paths don't apply to your file
> system, and...
>
> >
Hi
How do I create a valid file name and directory with pathlib?
When I create it using PurePosixPath I end up with an OSError due to an
obvously invlaid path being created.
import pathlib
for dates in fullUrl:
# print(dates)
time.sleep(0.3)
r = requests.get(dates)
data =
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 wil
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 accessing an api and downloading approx 20 json files from an api a
week. Having downloaded this year I have
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:00:00', .
Thanks
Sayth
--
Hi
I have got a successful script setup to rotate through dates and download json
data from the url.
As the api returns 200 whether successful I want to check if the file returned
is not successful.
when a file doesn't exist the api returns
{'RaceDay': None, 'ErrorInfo': {'SystemId': 200,
> >
> > 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
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"]['Meetings'][0
Hi
I have been toying with json and I particular area where I cannot get the
desired result a list of tuples as my return. The json from the API is way to
long but I don't think it will matter.
.. hitting url
data = r.json()
for item in data["RaceDay"]['Meetings'][0]['Races']:
On Thursday, 17 August 2017 09:03:59 UTC+10, Ian wrote:
wrote:
> > Morning
> >
> > I haven't ventured into classes much before. When trying to follow some
> > examples and create my own classes in a jupyter notebook I receive an error
> > that the class is undefined.
> >
> > So I created for
Morning
I haven't ventured into classes much before. When trying to follow some
examples and create my own classes in a jupyter notebook I receive an error
that the class is undefined.
So I created for practise a frog class
class frog(object):
def __init__(self, ftype, word):
> Another option is to test for type(value) == int:
>
> >>> before = ["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,
> {},0,0,9]
> >>> wanted = ["a","b",None,"c","d",1,False,1,3,[],1,9,
> {},9,0,0,0,0,0,0,0,0,0,0]
> >>> after = sorted(before, key=lambda x: x == 0 and type(x) == int)
>
On Friday, 7 July 2017 12:46:51 UTC+10, Rick Johnson wrote:
> On Thursday, July 6, 2017 at 9:29:29 PM UTC-5, Sayth Renshaw wrote:
> > I was trying to solve a problem and cannot determine how to filter 0's but
> > not false.
> >
> > Given a list like this
> > [&
I was trying to solve a problem and cannot determine how to filter 0's but not
false.
Given a list like this
["a",0,0,"b",None,"c","d",0,1,False,0,1,0,3,[],0,1,9,0,0,{},0,0,9]
I want to be able to return this list
["a","b",None,"c","d",1,False,1,3,[],1,9,{},9,0,0,0,0,0,0,0,0,0,0]
However if I
Thanks.
I left "base" out as i was trying to remove as much uneeded code from example
as possible. I had defined it as
base = datetime.datetime(2017,1,1)
Reading your code this sounds to simple :-).
def dates(first, numdays):
# generate datetime objects for extra clarity
# note
Hi
I am struggling to figure out how I can create a generator to provide values to
my url. My url needs to insert the year month and day in the url not as params
to the url.
import json
import requests
import datetime
# using this I can create a list of dates for the first 210 days of this
> > Thoughts or examples?
> >
> dateutil.rrule is what you may use e.g.
>
>
> In [38]: from dateutil import rrule
>
> In [39]: from datetime import date
> > Is there an obvious method I am missing in creating a list of dates? I want
> > to get a list of each Saturday and each Wednesday for the year 2017.
> >
> > It seems and maybe this is where I am wrong but doesn't the datetime
> > library already know the dates if yes is there an easy way to
Afternoon
Is there an obvious method I am missing in creating a list of dates? I want to
get a list of each Saturday and each Wednesday for the year 2017.
It seems and maybe this is where I am wrong but doesn't the datetime library
already know the dates if yes is there an easy way to query
Peter I really like this
The complete code:
>>> from collections import Counter
>>> def find_it(seq):
... [result] = [k for k, v in Counter(seq).items() if v % 3 == 0]
... return result
...
>>> test_seq = [20,1,-1,2,-2,3,3,5,5,1,2,4,20,4,-1,-2,5]
>>> find_it(test_seq)
But what
> > But the given problem states there will always only be one number appearing
> > an odd number of times given that is there a neater way to get the answer?
>
> Take a step back for a moment. Are you trying to find something that
> appears an odd number of times, or a number of times that
Hi
I have got this dictionary comprehension and it works but how can I do it
better?
from collections import Counter
def find_it(seq):
counts = dict(Counter(seq))
a = [(k, v) for k,v in counts.items() if v % 3 == 0]
return a[0][0]
test_seq =
> Replace the slice row[index:index+1] with row[index], either by building a
> new list or in place:
>
> >>> def show(data):
> ...for item in data: print(item)
> ...
> >>> def flatten_one(rows, index):
> ... return [r[:index] + r[index] + r[index+1:] for r in rows]
> ...
> >>> def
How can I flatten just a specific sublist of each list in a list of lists?
So if I had this data
[ ['46295', 'Montauk', '3', '60', '85', ['19', '5', '1', '0 $277790.00']],
['46295', 'Dark Eyes', '5', '59', '83', ['6', '4', '1', '0 $105625.00']],
['46295', 'Machinegun Jubs', '6', '53',
Afternoon
Is there a good library or way I could use to check that the author of the XML
doc I am using doesn't make small changes to structure over releases?
Not fully over this with XML but thought that XSD may be what I need, if I
search "python XSD" I get a main result for PyXB and
For completeness I was close this is the working code.
def get_list_of_names(generator_arg):
name_set = set()
for name in generator_arg:
base = os.path.basename(name.name)
filename = os.path.splitext(base)[0]
name_set.add(filename)
return name_set
def
Untested as i wrote this in notepad at work but, if i first use the generator
to create a set of filenames and then iterate it then call the generator anew
to process file may work?
Good idea or better available?
def get_list_of_names(generator_arg):
name_set = set()
for name in
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.basename(file.name)
write_to = os.path.join("output", os.path.splitext(base)[0] + ".csv")
with
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.
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
--
Afternoon
Is there a good library or way I could use to check that the author of the XML
doc I am using doesn't make small changes to structure over releases?
Not fully over this with XML but thought that XSD may be what I need, if I
search "python XSD" I get a main result for PyXB and
For completeness I was close this is the working code.
def get_list_of_names(generator_arg):
name_set = set()
for name in generator_arg:
base = os.path.basename(name.name)
filename = os.path.splitext(base)[0]
name_set.add(filename)
return name_set
def
Untested as i wrote this in notepad at work but, if i first use the generator
to create a set of filenames and then iterate it then call the generator anew
to process file may work?
Good idea or better available?
def get_list_of_names(generator_arg):
name_set = set()
for name in
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
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.basename(file.name)
write_to = os.path.join("output", os.path.splitext(base)[0] + ".csv")
with
1 - 100 of 236 matches
Mail list logo