https://github.com/ericchiang/fprint
Fancy printing in python
https://github.com/ericchiang/fprint
Last synced: 12 months ago
JSON representation
Fancy printing in python
- Host: GitHub
- URL: https://github.com/ericchiang/fprint
- Owner: ericchiang
- License: other
- Created: 2014-05-20T21:20:58.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-05-23T20:58:39.000Z (about 12 years ago)
- Last Synced: 2025-07-17T12:05:39.617Z (12 months ago)
- Language: Python
- Size: 613 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
#Fancy Printing
Printing functions I never want to rewrite again
###Install
```
$ pip install fprint
```
###Examples

```python
In [1]: from fprint import *
In [2]: print_info("Hey, some stuff just happened")
[14:05:21 14:24:43] INFO: Hey, some stuff just happened
In [3]: print_warning("Hmmm, I guess that's technically not allowed") # will print in YELLOW
[14:05:21 14:25:14] WARNING: Hmmm, I guess that's technically not allowed
In [4]: print_error("It's a trap!") # will print in RED
[14:05:21 14:25:19] ERROR: It's a trap!
In [5]: print_success("All done!") # will print in GREEN
[14:05:21 14:25:44] SUCCESS: All done!
In [6]: print_time()
[14:05:21 14:25:53]
In [7]: print_color("Check out my lightsaber","blue") # print colors!
Check out my lightsaber
In [8]: fancy_print("What a custom message",time=True,header="HEADER",color="blue") # underlying api
[14:05:21 14:27:30] HEADER: What a custom message
In [9]: repo_info = {'name': 'eric', 'repos': ['fprint', 'ANN.jl', 'Churn']}
In [10]: print_json(repo_info)
{
"repos": [
"fprint",
"ANN.jl",
"Churn"
],
"name": "eric"
}
In [11]: print_json(repo_info,indent=8)
{
"repos": [
"fprint",
"ANN.jl",
"Churn"
],
"name": "eric"
}
In [12]: print_info("this will be written to a file",file="tmp.log")
In [13]: print_info("this will be appended to the same file",file="tmp.log")
In [14]: ! cat tmp.log
[14:05:21 14:32:38] INFO: this will be written to a file
[14:05:21 14:32:44] INFO: this will be appened to the same file
In [15]:
```