Create Word/OpenOffice Documents with Python?
I'm relatively new to Python. My job requires me to create documents that are nearly identical except for the names and some other fields, aka variables. A lot of boilerplate language.
I want to use Python to input the changeable info and then generate an editable document with the proper formatting... Like centering or tabs.
After a while of searching I cannot tell if this is possible with Python. Is it? Should I be looking somewhere else? If not, I would love to be pointed in the right direction. It doesn't seem to be very simple. I've looked into Word, OpenOffice, Google Docs... Any help/suggestions would be greatly appreciated!
/r/Python
https://redd.it/6b7rg4
I'm relatively new to Python. My job requires me to create documents that are nearly identical except for the names and some other fields, aka variables. A lot of boilerplate language.
I want to use Python to input the changeable info and then generate an editable document with the proper formatting... Like centering or tabs.
After a while of searching I cannot tell if this is possible with Python. Is it? Should I be looking somewhere else? If not, I would love to be pointed in the right direction. It doesn't seem to be very simple. I've looked into Word, OpenOffice, Google Docs... Any help/suggestions would be greatly appreciated!
/r/Python
https://redd.it/6b7rg4
reddit
Create Word/OpenOffice Documents with Python? • r/Python
I'm relatively new to Python. My job requires me to create documents that are nearly identical except for the names and some other fields, aka...
[Question] A flask newbie and I'm following the official Flask tutorial. Can someone please ELI5 the following snippet?
....
# 1
app.config.from_object(__name__)
# 2
app.config.update(dict(
DATABASE=os.path.join(app.root_path, 'flaskr.db'),
SECRET_KEY='development key',
USERNAME='admin',
PASSWORD='default'
))
# 3
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
....
I *kind of* understand `# 2`, it sets the app's configuration, right? But configuration for what? And when is it used?
I *think* `#1` implies that `# 2` can be put on another file (and you pass the file path instead of `__name__`)
`#3` is where I'm still clueless.
Any hints?
EDIT: I haven't noticed from the sidebar that **[AF]** is the tag used for asking questions. Sorry!
/r/flask
https://redd.it/6b952s
....
# 1
app.config.from_object(__name__)
# 2
app.config.update(dict(
DATABASE=os.path.join(app.root_path, 'flaskr.db'),
SECRET_KEY='development key',
USERNAME='admin',
PASSWORD='default'
))
# 3
app.config.from_envvar('FLASKR_SETTINGS', silent=True)
....
I *kind of* understand `# 2`, it sets the app's configuration, right? But configuration for what? And when is it used?
I *think* `#1` implies that `# 2` can be put on another file (and you pass the file path instead of `__name__`)
`#3` is where I'm still clueless.
Any hints?
EDIT: I haven't noticed from the sidebar that **[AF]** is the tag used for asking questions. Sorry!
/r/flask
https://redd.it/6b952s
reddit
[Question] A flask newbie and I'm following the official... • r/flask
.... # 1 app.config.from_object(__name__) # 2 app.config.update(dict( DATABASE=os.path.join(app.root_path,...
Using BeautifulSoup to scrape an inmate roster.
I have html that looks like this.
<div class = "inmate">
<div class = "inmate-photo">......</div>
<div class = "inmate-fields">
<div class = "inmate-name">......</div>
etc.....
</div>
</div>
I can grab each item independently but I am having an issue with making each inmates "fields" reference the particular inmate.
like
Inmate(1)
Name
Booking Number
Date
Charges
Inmate(2)
Name
Booking Number
Date
Charges
...
Any help would be much appreciated. Thx
/r/Python
https://redd.it/6b7ulj
I have html that looks like this.
<div class = "inmate">
<div class = "inmate-photo">......</div>
<div class = "inmate-fields">
<div class = "inmate-name">......</div>
etc.....
</div>
</div>
I can grab each item independently but I am having an issue with making each inmates "fields" reference the particular inmate.
like
Inmate(1)
Name
Booking Number
Date
Charges
Inmate(2)
Name
Booking Number
Date
Charges
...
Any help would be much appreciated. Thx
/r/Python
https://redd.it/6b7ulj
reddit
Using BeautifulSoup to scrape an inmate roster. • r/Python
I have html that looks like this. ...... <div class =...
Need some help making a POST request to logout with django-rest-auth
hi, I'm using django-rest-auth [relevant link](http://django-rest-auth.readthedocs.io/en/latest/api_endpoints.html) and I'm using it with JWT authentication. I am trying to use its /rest-auth/logout endpoint and I SEE in console that I'm getting a successful return but when I refresh the website, I am still logged in and able to make POST/DESTROY requests.
FYI:
I am using localStorage to store the JWT when logged in.
I am also using axios to make a POST request with the authorization header. Can anyone help me understand what is going on?
One thing I did that kind of worked was when I make a POST request to
localhost:8000/rest-auth/logout/
I then update the localStorage with the new JWT (which should be invalid since it's deleted) but I'm not sure if that's a good method.
Any help would be greatly appreciated.
/r/django
https://redd.it/6b9vsg
hi, I'm using django-rest-auth [relevant link](http://django-rest-auth.readthedocs.io/en/latest/api_endpoints.html) and I'm using it with JWT authentication. I am trying to use its /rest-auth/logout endpoint and I SEE in console that I'm getting a successful return but when I refresh the website, I am still logged in and able to make POST/DESTROY requests.
FYI:
I am using localStorage to store the JWT when logged in.
I am also using axios to make a POST request with the authorization header. Can anyone help me understand what is going on?
One thing I did that kind of worked was when I make a POST request to
localhost:8000/rest-auth/logout/
I then update the localStorage with the new JWT (which should be invalid since it's deleted) but I'm not sure if that's a good method.
Any help would be greatly appreciated.
/r/django
https://redd.it/6b9vsg
Python for Scientists and Engineers is Now Free to Read Online
Hello /r/python,
Python for Scientists and Engineers was the first book I wrote, and the one I still get queries about. It had been out of print for more than a year, but I could never get myself to update it, because it looked like too much work.
Recently, I asked for help in updating it, and a few people volunteered. Thanks to these volunteers, the book is now free to read online (and will remain so).
The book assumes you already know Python, or any other language. I feel there are too many resources for beginners, and not enough for intermediate/advanced programmers.
Anyway, check it out here:
[http://pythonforengineers.com/python-for-scientists-and-engineers/](http://pythonforengineers.com/python-for-scientists-and-engineers/)
Cheers,
Shantnu
/r/Python
https://redd.it/6bat6d
Hello /r/python,
Python for Scientists and Engineers was the first book I wrote, and the one I still get queries about. It had been out of print for more than a year, but I could never get myself to update it, because it looked like too much work.
Recently, I asked for help in updating it, and a few people volunteered. Thanks to these volunteers, the book is now free to read online (and will remain so).
The book assumes you already know Python, or any other language. I feel there are too many resources for beginners, and not enough for intermediate/advanced programmers.
Anyway, check it out here:
[http://pythonforengineers.com/python-for-scientists-and-engineers/](http://pythonforengineers.com/python-for-scientists-and-engineers/)
Cheers,
Shantnu
/r/Python
https://redd.it/6bat6d
Python for Engineers
Python for Scientists and Engineers
Python for Scientists and Engineers was the first book I wrote. I've decided to
make it free to read online, though if you want to read it on your laptop/phone,
you can also buy a copy here [https://leanpub.com/pythonforengineers/].
Source Code: The code…
make it free to read online, though if you want to read it on your laptop/phone,
you can also buy a copy here [https://leanpub.com/pythonforengineers/].
Source Code: The code…
Another Form Question
I'm making a form that doesn't load a separate page. It is always present on the main page when the user doesn't have their location entered. The application is a single page web app that I'm building to play around with Django. I've been stuck on getting the form to save the user's location (that they input, not being inferred from the browser)
I've posted code snippits to:
https://pastebin.com/MQf99HR2
Edit:
I've been researching the forms and theory behind them for several days. Every tutorial for a blog has a new page load and defines a model form (? is that the right term ?) then just makes a template that is autopopulated form the model form.
I don't want to do this. I want the form to be ever present on my main page. I've still defined a form model in forms.py but am not sure how to pull it all together.
/r/django
https://redd.it/6bbom3
I'm making a form that doesn't load a separate page. It is always present on the main page when the user doesn't have their location entered. The application is a single page web app that I'm building to play around with Django. I've been stuck on getting the form to save the user's location (that they input, not being inferred from the browser)
I've posted code snippits to:
https://pastebin.com/MQf99HR2
Edit:
I've been researching the forms and theory behind them for several days. Every tutorial for a blog has a new page load and defines a model form (? is that the right term ?) then just makes a template that is autopopulated form the model form.
I don't want to do this. I want the form to be ever present on my main page. I've still defined a form model in forms.py but am not sure how to pull it all together.
/r/django
https://redd.it/6bbom3
Pastebin
<form action="{% url 'analytics:location-add' %}" method="post - Pastebin.com
Flask GitHub project mainly Java-Script and CSS?
Hi there!
I'm making my first [FlaskApp](https://github.com/SonGokussj4/beta-issues) and it should be mainly `HTML` and `Python` code. But when I added `bootstrap` and because of `modal` manipulations even the `JQuery` and these kind of things, my *Languages bar* looks like:
- JavaScript 69%
- CSS 27%
- HTML 2%
- Python 2%
Is this normal for this kind of application?
Or I shouldn't have those bootstrap/jquery libraries in my repo and instead, have in documentation *"You have to download this and that and put it here and there"*.
(Reasoning: I don't want anyone think I know any JavaScript because I don't... But when they see this, ...)
/r/flask
https://redd.it/6b9pn1
Hi there!
I'm making my first [FlaskApp](https://github.com/SonGokussj4/beta-issues) and it should be mainly `HTML` and `Python` code. But when I added `bootstrap` and because of `modal` manipulations even the `JQuery` and these kind of things, my *Languages bar* looks like:
- JavaScript 69%
- CSS 27%
- HTML 2%
- Python 2%
Is this normal for this kind of application?
Or I shouldn't have those bootstrap/jquery libraries in my repo and instead, have in documentation *"You have to download this and that and put it here and there"*.
(Reasoning: I don't want anyone think I know any JavaScript because I don't... But when they see this, ...)
/r/flask
https://redd.it/6b9pn1
GitHub
SonGokussj4/beta-issues
beta-issues - My first flask app
Has Anyone Ever Actually Been Able to Compile PyQt5 to Android with PyQtDeploy?
I love PyQt, I use it almost every day, but for the life of me I can't understand pyqtdeploy, and from reading other testimonies, I'm not the only one.
Has anyone actually been able to make this work? I know getting a language onto a platform it wasn't built for is a pain, but god-damn.
Also, I'm well aware of Kivy, it has very similar pitfalls.
/r/Python
https://redd.it/6b9zua
I love PyQt, I use it almost every day, but for the life of me I can't understand pyqtdeploy, and from reading other testimonies, I'm not the only one.
Has anyone actually been able to make this work? I know getting a language onto a platform it wasn't built for is a pain, but god-damn.
Also, I'm well aware of Kivy, it has very similar pitfalls.
/r/Python
https://redd.it/6b9zua
reddit
Has Anyone Ever Actually Been Able to Compile PyQt5 to... • r/Python
I love PyQt, I use it almost every day, but for the life of me I can't understand pyqtdeploy, and from reading other testimonies, I'm not the only...
Where does a generator store it's values?
In [1]: var = ['a', 'b', 'c']
In [2]: gen = (v for v in var)
In [3]: del var
In [4]: gen.next()
Out[4]: 'a'
In [5]: gen.__sizeof__()
Out[5]: 48
In [6]: var = ['a', 'b', 'c', 'd', 'e', 'f']
In [7]: gen = (v for v in var)
In [8]: gen.next()
Out[8]: 'a'
In [9]: del var
In [10]: gen.next()
Out[10]: 'b'
In [11]: gen.__sizeof__()
Out[11]: 48
Where exactly is var stored, and how does the generator find it's values? If it is still in memory, why doesn't the generator's size change?
/r/Python
https://redd.it/6b9mt1
In [1]: var = ['a', 'b', 'c']
In [2]: gen = (v for v in var)
In [3]: del var
In [4]: gen.next()
Out[4]: 'a'
In [5]: gen.__sizeof__()
Out[5]: 48
In [6]: var = ['a', 'b', 'c', 'd', 'e', 'f']
In [7]: gen = (v for v in var)
In [8]: gen.next()
Out[8]: 'a'
In [9]: del var
In [10]: gen.next()
Out[10]: 'b'
In [11]: gen.__sizeof__()
Out[11]: 48
Where exactly is var stored, and how does the generator find it's values? If it is still in memory, why doesn't the generator's size change?
/r/Python
https://redd.it/6b9mt1
reddit
Where does a generator store it's values? • r/Python
In [1]: var = ['a', 'b', 'c'] In [2]: gen = (v for v in var) In [3]: del var In [4]:...
Using Python and Google Docs to Build Books
https://www.pydanny.com/using-python-and-google-docs-to-build-books.html
/r/Python
https://redd.it/6bdwer
https://www.pydanny.com/using-python-and-google-docs-to-build-books.html
/r/Python
https://redd.it/6bdwer
reddit
Using Python and Google Docs to Build Books • r/Python
2 points and 0 comments so far on reddit
Using DJango purely as a REST aPI provider?
Hello,
I am trying to find resources on building a REST API using Django but so far I have not been able to find resources specifically for that. Would anyone have any recommendations of this topic? Alternatively, if Django is not recommendable for this kind of project, what would you recommend? Not limited to Python.
Thank you!
/r/djangolearning
https://redd.it/6bbudz
Hello,
I am trying to find resources on building a REST API using Django but so far I have not been able to find resources specifically for that. Would anyone have any recommendations of this topic? Alternatively, if Django is not recommendable for this kind of project, what would you recommend? Not limited to Python.
Thank you!
/r/djangolearning
https://redd.it/6bbudz
reddit
Using DJango purely as a REST aPI provider? • r/djangolearning
Hello, I am trying to find resources on building a REST API using Django but so far I have not been able to find resources specifically for that....
iPython flask shell
[iPython flask shell](https://pypi.python.org/pypi/flask-shell-ipython/0.2.2)
This is a flask extensions that doesn't get the credit it deserves. It saved me a couple of times, especially when debugging database connections.
EDIT: added link
/r/flask
https://redd.it/6b9fob
[iPython flask shell](https://pypi.python.org/pypi/flask-shell-ipython/0.2.2)
This is a flask extensions that doesn't get the credit it deserves. It saved me a couple of times, especially when debugging database connections.
EDIT: added link
/r/flask
https://redd.it/6b9fob
pypi.python.org
flask-shell-ipython 0.2.2 : Python Package Index
Replace default `flask shell` command by similar command running IPython.
Sending html form data to a python file
**Edit: Figured it out. Check my comment [here](https://www.reddit.com/r/djangolearning/comments/6az249/sending_html_form_data_to_a_python_file/dhkeb8x/)**
Hey! First time visiting the subreddit. Trying to do a little project in Django and have been stuck on something for a while :)
Here's what I'm trying to do:
* Have the user input data on a form
* After clicking submit, the data is able to be loaded into a python file
I'm a bit shaky on how to do it. I know it involves some GET/POST method. Code examples below.
**Template**
{% extends "personal/header.html" %}
{% block content %}
{% for user in object_list %}
<h4>User Joined: {{ user.date|date:"Y-m-d" }}
<a href="/pending/{{user.id}}"> {{user.username}}</a> </h4>
<form name="setup" action="." method="POST">{% csrf_token %}
{{form.as_table}}
<input type="hidden" name="username" value={{user.username}}>
<input type="hidden" name="password" value={{user.password}}>
<input type="hidden" name="tags" value={{user.tags}}>
Likes per day: <input type="text" name="likes" value="">
Tags: <input type="text" name="tags" value="tag1,tag2,tag3,etc">
Follows per day:<input type="text" name="follows" value="600">
Proxy <input type="text" name="proxy" value="IP Address">
<input type="submit" value="Start"></form>
{% endfor %}
{% endblock %}
From here, I'm not sure:
* What I specify as the action
* How I adjust the urls file
* Do I need to use views?
I've done a lot of searching on StackOverflow, Django documentation and Youtube. For some reason, can't seem to wrap my head around what to do next. Also, I'm not worried about sending the password plain text. This isn't anything serious :)
/r/djangolearning
https://redd.it/6az249
**Edit: Figured it out. Check my comment [here](https://www.reddit.com/r/djangolearning/comments/6az249/sending_html_form_data_to_a_python_file/dhkeb8x/)**
Hey! First time visiting the subreddit. Trying to do a little project in Django and have been stuck on something for a while :)
Here's what I'm trying to do:
* Have the user input data on a form
* After clicking submit, the data is able to be loaded into a python file
I'm a bit shaky on how to do it. I know it involves some GET/POST method. Code examples below.
**Template**
{% extends "personal/header.html" %}
{% block content %}
{% for user in object_list %}
<h4>User Joined: {{ user.date|date:"Y-m-d" }}
<a href="/pending/{{user.id}}"> {{user.username}}</a> </h4>
<form name="setup" action="." method="POST">{% csrf_token %}
{{form.as_table}}
<input type="hidden" name="username" value={{user.username}}>
<input type="hidden" name="password" value={{user.password}}>
<input type="hidden" name="tags" value={{user.tags}}>
Likes per day: <input type="text" name="likes" value="">
Tags: <input type="text" name="tags" value="tag1,tag2,tag3,etc">
Follows per day:<input type="text" name="follows" value="600">
Proxy <input type="text" name="proxy" value="IP Address">
<input type="submit" value="Start"></form>
{% endfor %}
{% endblock %}
From here, I'm not sure:
* What I specify as the action
* How I adjust the urls file
* Do I need to use views?
I've done a lot of searching on StackOverflow, Django documentation and Youtube. For some reason, can't seem to wrap my head around what to do next. Also, I'm not worried about sending the password plain text. This isn't anything serious :)
/r/djangolearning
https://redd.it/6az249
reddit
Sending html form data to a python file • r/djangolearning
Hey thanks for the reply! I actually figured it out. I'm gonna post it here as well as up top if people find this later. I'm a Django noobie and...
Dave Beazley demonstrates how to monitor real-time data in Python
https://www.youtube.com/watch?v=xFkqOdAluJ0
/r/Python
https://redd.it/6be6xg
https://www.youtube.com/watch?v=xFkqOdAluJ0
/r/Python
https://redd.it/6be6xg
YouTube
Using Python Generator to Monitor Data
David Beazley demonstrates how to use a generator in Python to watch real-time data sources.
This is an excerpt from the Pearson video course "Python Programming Language".
Purchase the full course and save 50% with discount code YOUTUBE at www.informi…
This is an excerpt from the Pearson video course "Python Programming Language".
Purchase the full course and save 50% with discount code YOUTUBE at www.informi…
How to Create a Facebook Messenger Bot with Python Flask
http://blog.apcelent.com/create-a-facebook-messenger-bot-with-python-flask.html
/r/flask
https://redd.it/6bfgdx
http://blog.apcelent.com/create-a-facebook-messenger-bot-with-python-flask.html
/r/flask
https://redd.it/6bfgdx
reddit
How to Create a Facebook Messenger Bot with Python Flask • r/flask
2 points and 0 comments so far on reddit
How to Build a Discussion Forum in Django: Designing Data Model
https://hashedin.com/2017/04/21/django-models-designing-data-model-for-discussion-forum-charcha/
/r/django
https://redd.it/6bh6j7
https://hashedin.com/2017/04/21/django-models-designing-data-model-for-discussion-forum-charcha/
/r/django
https://redd.it/6bh6j7
HashedIn
Django Models - Designing Data Model for Discussion Forum (Charcha)
Discusses the requirements and the process of designing the django models for the requirements in an efficent manner.
Haystack Rich Content Extraction Example
In the [example](https://django-haystack.readthedocs.io/en/v2.6.0/rich_content_extraction.html) there is a line:
{{ extracted.contents|striptags|safe }}
But in the Django docs, there is a note on the striptags template filter that says
> Note that striptags doesn’t give any guarantee about its output being HTML safe, particularly with non valid HTML input. So NEVER apply the safe filter to a striptags output. If you are looking for something more robust, you can use the bleach Python library, notably its clean method.
How to reconcile this?
/r/djangolearning
https://redd.it/6aw0v3
In the [example](https://django-haystack.readthedocs.io/en/v2.6.0/rich_content_extraction.html) there is a line:
{{ extracted.contents|striptags|safe }}
But in the Django docs, there is a note on the striptags template filter that says
> Note that striptags doesn’t give any guarantee about its output being HTML safe, particularly with non valid HTML input. So NEVER apply the safe filter to a striptags output. If you are looking for something more robust, you can use the bleach Python library, notably its clean method.
How to reconcile this?
/r/djangolearning
https://redd.it/6aw0v3
Optimal project structure when combing Django with front end such as npm and materialize.css?
The Project structure I've got looks now like this:
- /Root
- - /proj_env
- - /main_app
- - /website_app
- - - /templates
- db.sqlite3
- manage.py
I'm not showing every single file here as you see but just a rough example of my project structure. And I'm wondering where to initialize npm and can I just put a **static** directory in the root directory or does it need to be in one of the app directories?
I just know that node modules should at least not be in a static directory.
/r/djangolearning
https://redd.it/6aef6t
The Project structure I've got looks now like this:
- /Root
- - /proj_env
- - /main_app
- - /website_app
- - - /templates
- db.sqlite3
- manage.py
I'm not showing every single file here as you see but just a rough example of my project structure. And I'm wondering where to initialize npm and can I just put a **static** directory in the root directory or does it need to be in one of the app directories?
I just know that node modules should at least not be in a static directory.
/r/djangolearning
https://redd.it/6aef6t
reddit
Optimal project structure when combing Django... • r/djangolearning
The Project structure I've got looks now like this: - /Root - - /proj_env - - /main_app - - /website_app - - - /templates ...