Search Results
|
Post |
Author |
Forum |
Replies |
Views |
Posted
[asc]
|
|
|
Thread: Making .exe file that requires access to text and html files
Post: Making .exe file that requires access to text and ...
I've got a python project with the following directory:
pull.py
scrape.py
emailer.py
main.py
winter_2020.html
winter_2020.txt
I've converted the main.py (which requires access to the html and txt fi... |
|
ClassicalSoul |
General Coding Help |
0 |
1,583 |
Apr-23-2020, 05:03 PM |
|
|
Thread: One-time actions when iterating
Post: One-time actions when iterating
Please note I've made a substantive edit to my original post
Suppose you had the following code, where x is an iterable:
for i in x:
# do thing 1
# do thing 2
if <condition>:
... |
|
ClassicalSoul |
General Coding Help |
1 |
1,734 |
Apr-23-2020, 04:40 PM |
|
|
Thread: smtplib: string formatting not carrying over to email
Post: smtplib: string formatting not carrying over to em...
The string formatting I specify in python doesn't carry over perfectly to email when I send it via smtplib.
def main():
pull() # pulls html grades from university website
graded_courses = s... |
|
ClassicalSoul |
General Coding Help |
1 |
2,658 |
Apr-22-2020, 09:20 PM |
|
|
Thread: Selenium: accessing a drop-down menus without select tags
Post: Selenium: accessing a drop-down menus without sele...
I am trying to use Selenium to access a dropdown menu in this site. The site has no select tags.
user = os.environ['LATINDUSERNAME']
pw = os.environ['LATINDPASSWORD']
login = 'http://latindiscussio... |
|
ClassicalSoul |
Web Scraping & Web Development |
0 |
2,071 |
Apr-19-2020, 03:53 PM |
|
|
Thread: Regex excluding
Post: Regex excluding
How could I use regex to match everything not in between hyphens? E.g. re.search(r"<>", "- i don't want this - I do want this")
Edit: This particular example is simple, and could be solved usi... |
|
ClassicalSoul |
General Coding Help |
2 |
2,167 |
Apr-17-2020, 02:26 PM |
|
|
Thread: Transforming nested key-tuples into their dictionary values
Post: RE: Transforming nested key-tuples into their dict...
My goal is to substitute the keys in the input object with their corresponding dictionary value. I want to write clearer code or faster code (or both). In particular, I'm wondering if there is no more... |
|
ClassicalSoul |
General Coding Help |
4 |
2,672 |
Apr-11-2020, 12:06 PM |
|
|
Thread: re.sub(r"\W", v, s) vs. re.sub(r"\W+", v, s)
Post: re.sub(r"\W", v, s) vs. re.sub(r"\W+", v, s)
Is there any difference between re.sub(r"\W", v, s) and re.sub(r"\W+", v, s)? Won't they both equally replace all non-alphanumeric characters in s with v? |
|
ClassicalSoul |
General Coding Help |
1 |
3,138 |
Apr-11-2020, 12:00 PM |
|
|
Thread: Transforming nested key-tuples into their dictionary values
Post: Transforming nested key-tuples into their dictiona...
Surely there has got to be a better way of doing this?
>>> d = dict(enumerate(list('abcde')))
>>> INPUT = [[(0, 1, 2), (3, 4)], [(0, 1, 3), (2, 4)], [(0, 1, 4), (2, 3)], [(0, 2, 3)... |
|
ClassicalSoul |
General Coding Help |
4 |
2,672 |
Apr-11-2020, 01:15 AM |
|
|
Thread: fmt_directory_entry = "{counter:>02}. {director:<52} {avg}"
Post: RE: fmt_directory_entry = "{counter:>02}. {directo...
Hmm... So I take that we wouldn't be able to replace the 0 stand-in with some other symbol?
Quote:The '#' option causes the “alternate form” to be used for the conversion. The alternate form is defin... |
|
ClassicalSoul |
General Coding Help |
7 |
2,608 |
Apr-09-2020, 02:12 PM |
|
|
Thread: fmt_directory_entry = "{counter:>02}. {director:<52} {avg}"
Post: RE: fmt_directory_entry = "{counter:>02}. {directo...
Hi buran,
I've read through the documentation, but I can't seem to find what I'm looking for - especially with regards to why that 0 does what is does. Do you think you could give me a little bit fur... |
|
ClassicalSoul |
General Coding Help |
7 |
2,608 |
Apr-09-2020, 01:54 PM |
|
|
Thread: fmt_directory_entry = "{counter:>02}. {director:<52} {avg}"
Post: fmt_directory_entry = "{counter:>02}. {director:<5...
What exactly is going on with the {counter:>02} parameter in the fmt_directory_entry assignment? In particular, how is it effected that 0 should be inserted to the left of counter if len(counter) &... |
|
ClassicalSoul |
General Coding Help |
7 |
2,608 |
Apr-09-2020, 01:46 PM |
|
|
Thread: sum(i for i in range(10))
Post: sum(i for i in range(10))
The documentation for sum() states that it takes as its argument an iterable. How does this make sense of the code sum(i for i in range(10)), because the for loop isn't an iterable is it? |
|
ClassicalSoul |
General Coding Help |
2 |
1,941 |
Apr-08-2020, 07:32 PM |
|
|
Thread: Accessing method as function object
Post: Accessing method as function object
Hi,
How do you access a class method as a function object (not a function call)? The context is that I would like to use the help() function on random.shuffle(), but that results in an error because ... |
|
ClassicalSoul |
General Coding Help |
2 |
2,025 |
Feb-14-2020, 04:22 PM |
|
|
Thread: More Efficent Way of Generating Permutations/ w Rep
Post: More Efficent Way of Generating Permutations/ w Re...
Hi,
My current method of generating permutations with repetition is to first generate all combinations with repetition, then find the permutations (w/out repetition) of each combination, and lastly t... |
|
ClassicalSoul |
General Coding Help |
2 |
2,704 |
Aug-21-2019, 10:12 PM |
|
|
Thread: while + if + elif + else combination
Post: while + if + elif + else combination
What is wrong with this code?? If I input a number it says I get 'That is not a number'. Why?
while True:
text = input('Number (or \'Quit\' to exit): ')
if text == 'Quit':
print('...... |
|
ClassicalSoul |
General Coding Help |
1 |
2,204 |
Mar-27-2019, 03:40 PM |
|
|
Thread: str.format rounding to the left of the decimal
Post: str.format rounding to the left of the decimal
Hi, I was wondering how I could make string.format round to the left of the decimal.
>>> x = 4. 542412343
>>> '{0} rounded to {1} decimals is {2: .1f}'.format(x, 4, x)
>>>... |
|
ClassicalSoul |
General Coding Help |
2 |
2,490 |
Mar-26-2019, 09:14 PM |
|
|
Thread: blank space + input()
Post: RE: blank space + input()
(Mar-05-2019, 11:21 AM)perfringo Wrote: One word of caution about using str.isnumeric. Documentation states:" Return true if all characters in the string are numeric characters, and there is at leas... |
|
ClassicalSoul |
General Coding Help |
6 |
4,207 |
Mar-05-2019, 05:38 PM |
|
|
Thread: blank space + input()
Post: blank space + input()
Hi, how do make it so that a blank space precedes an input() function, and even more specifically, how would I make it so that this applies only to the final line?
text = ''
while text != 'quit':
... |
|
ClassicalSoul |
General Coding Help |
6 |
4,207 |
Mar-05-2019, 02:15 AM |
|
|
Thread: Sum of 1-100
Post: Sum of 1-100
Hi,
I came across this and was wondering about the mechanics:
>>> x = 0
>>> r = range(1, 101)
>>> for n in r:
... x = n + x
...
>>> x
5050Comparing it to thi... |
|
ClassicalSoul |
General Coding Help |
2 |
2,798 |
Mar-02-2019, 02:01 PM |
|
|
Thread: Intricacies of Aliasing
Post: Intricacies of Aliasing
Hi,
Typically aliasing is done by assigning the 'original' variable to some other variable. But I was exploring the intricacies of aliasing, and am wondering what might explain the following phenomen... |
|
ClassicalSoul |
General Coding Help |
2 |
2,250 |
Mar-01-2019, 11:57 AM |