Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    ale rimoldi
    @aoloe
    seems to work here... just make sure that you have all the spaces correct.
    Stas Kaino
    @StasKaino_twitter
    Ale, can you please explain what for we apply the section <br/>\n\n</p> in re.sub(r'<br/>\n\n</p><a class="anchor-column noCont" name="column_\d{4}"> </a><p><b>\d{2} \w{3} \d{4} : Column\d{4}</b></p><p>', '', content) ?
    also, do you know how to search text in the console? it searches but nothing is highlighted in conda
    is not working
    if you look at the end of the output and search for 11 Feb 2016 : Column 1754 - this thing is still there
    Stas Kaino
    @StasKaino_twitter
    maybe you could guide me to some resource where I could read in simple language how is re.sub organised? I am not sure where the spaces are wrong
    ale rimoldi
    @aoloe
    if i replace my sub through your sub i get a different result...
    Stas Kaino
    @StasKaino_twitter
    can you please repeat? I dont understand
    maybe you can just show me on my code why this is not working?
    ale rimoldi
    @aoloe
    you're missing a space after Column
    i've put your sub() in my code and i also got the wrong result.
    i was looking for the difference and found it after Column... i hope it was the only difference
    Stas Kaino
    @StasKaino_twitter
    do you think I need this at the beginning?
    <br/>\n\n</p>
    you mean we need use: re.sub(r'<a class="anchor-column noCont" name="column_\d{4}"> </a><p><b>\d{2} \w{3} \d{4} : Column \d{4}</b></p><p>', '', content) ?
    Stas Kaino
    @StasKaino_twitter
    ok.. space did work, but I still wonder if we need <br/>\n\n</p>
    ale rimoldi
    @aoloe
    you don't need that. but if you remove them, you'll have a couple of new lines in the string... which is not very nice.
    Stas Kaino
    @StasKaino_twitter
    I think it is better not to touch this as it corresponds to previous tags
    Stas Kaino
    @StasKaino_twitter
    Ale do you know a way I can make the output on the console to show every item list on the new line?
    Stas Kaino
    @StasKaino_twitter
    I figured out both how to search console and why we used <br/>\n\n</p>. I thought it might ruin some previous tags but it actually works
    still missing is how to output list in console line be line...
    ale rimoldi
    @aoloe
    as far as i can tell, i've balanced the tags in my sub()...
    and i have no idea why you want to output the list in the console, but, of course, you can do that with a print().
    and eventually remove the publications array
    Stas Kaino
    @StasKaino_twitter
    I mean something else. there should be a way how to force print(publications) or effectively print(resultList) to show every new element on the new line in console?
    also do you know how to fix this: i dont know how to send it here - there is no attachment functionality I guess - I have send on email
    ale rimoldi
    @aoloe
    you can print(list)... but you'll get the full list each time.
    Stas Kaino
    @StasKaino_twitter
    really simple question but how do I close csv-output i
    I see about priniting. thanks you
    ale rimoldi
    @aoloe
    if you want to print each row, just store it in variable before adding to the full list.
    and print inbetween.
    Stas Kaino
    @StasKaino_twitter
    OK.
    ale rimoldi
    @aoloe
    the csv file is closed when the script is over.
    Stas Kaino
    @StasKaino_twitter
    unfortunately not in my case
    csv_output = csv.writer(open('xxx.csv', 'w', newline=''))
    csv_output.writerows(publications)
    when the script is over the file is open somewhere in the back
    and I cant deleted if I go to the folder where it is storing
    since it is "opened by Python"
    ale rimoldi
    @aoloe
    euh...
    Stas Kaino
    @StasKaino_twitter
    I thought of adding this: csv_output.close() but it is not an object with close functionality
    I guess I first need to somehow close and then add in the script that it closes it self
    ale rimoldi
    @aoloe
    the you should store the opened file in a variable before passing it to the csv module:
    Stas Kaino
    @StasKaino_twitter
    yeah i see the point
    Stas Kaino
    @StasKaino_twitter
    cleared that
    new thing

    ipdb> elem('a')
    [<a href="160211-0002.htm">Next Section</a>]

    this is from debugger. question is how can I call elem so that it gives me back only href contents (i.e.160211-0002.htm)?

    Stas Kaino
    @StasKaino_twitter
    do i need to sue again recursive equations?
    Stas Kaino
    @StasKaino_twitter
        if elem.text == "Next Section":         
            getUrl = elem('a').get['href']
    I am trying to extract the href from the elem but no luck so far
    ale rimoldi
    @aoloe
    no idea, but googling "beautifulsoup a href" (got through the autocomplete...) i got https://stackoverflow.com/questions/5815747/beautifulsoup-getting-href