Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I'd like some help understanding why the third call to print() raises AttributeError: 'NoneType' object has no attribute 'format' from os import path import inspect def myfunction(): pri...
#5: Post edited
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
``` from os import path- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
- myfunction()
- ```
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
- ```
- from os import path
- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
- myfunction()
- ```
#4: Post edited
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
- ``` from os import path
- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
myfunction()```
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
- ``` from os import path
- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
- myfunction()
- ```
#3: Post edited
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
from os import path- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
myfunction()
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
- ``` from os import path
- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
- myfunction()```
#2: Post edited
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
'from os import path- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
myfunction()'
- I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'`
- from os import path
- import inspect
- def myfunction():
- print(inspect.currentframe().f_code.co_name, path.basename(__file__))
- print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}")
- print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__))
- myfunction()
#1: Initial revision
Help me understand why python3 string.format() raises Attribute error
I'd like some help understanding why the third call to print() raises `AttributeError: 'NoneType' object has no attribute 'format'` 'from os import path import inspect def myfunction(): print(inspect.currentframe().f_code.co_name, path.basename(__file__)) print(f"{inspect.currentframe().f_code.co_name} {path.basename(__file__)}") print("{} {}").format(inspect.currentframe().f_code.co_name, path.basename(__file__)) myfunction()'