Comments (3)
raceback (most recent call last):
File ~/anaconda3/lib/python3.11/site-packages/spyder_kernels/py3compat.py:356 in compat_exec
exec(code, globals, locals)
File ~/expenses.tracker.py:67
main()
File ~/expenses.tracker.py:17 in main
print(expense)
File ~/expense.py:17 in repr
return f"Expense, {self.name}, {self.category}, ${self.amount:.2f}"
ValueError: Unknown format code 'f' for object of type 'str'
from spyder.
Someone can help me out with these error
from spyder.
Hey @jaime719, thanks for reporting. I think the problem is this part of your f-string:
${self.amount:.2f}
Most probably self.amount
is not a number in your code (i.e. an integer or float in your code) but a string. And that's why Python can't get two decimals of a string to print it along with your other attributes (i.e. self.name
and self.category
).
Let us know if that helps you to solve this problem.
from spyder.
Related Issues (20)
- n次简单随机游走模拟路线
- Attribute Qt::AA_UseSoftwareOpenGL must be set before QCoreApplication is created. HOT 1
- Launched spyder from miniconda using a batch file HOT 1
- macOS installer notarization error
- How to access environment variables in standalone Spyder? HOT 1
- Remove variables HOT 5
- MaheshOrchu.... HOT 1
- Cannot get spyder to work in new environment HOT 2
- Redoing (Ctrl + Shift + Z) doesnt work on new pc
- Do not translate "commit" in Spyder IDE HOT 1
- Non-recognized command message when running code that gives a traceback with a custom interpreter set on Windows (IPython Console) HOT 4
- Try to pip factor_analyzer HOT 2
- Kernel keeps dying HOT 11
- An error ocurred while starting the kernel HOT 2
- no attribute 'iteritems' in the DataFrame object HOT 1
- install app problem HOT 1
- Improvement Suggestion On The Data Frame Scroll Bar + Bug
- pylsp >=1.4.1;<1.5.0 : 1.11.0 (NOK) ... on anaconda HOT 1
- Spyder Directory HOT 3
- Newly installed Spyder: Kernel doesn't start HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spyder.