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.
Help me understand why python3 string.format() raises Attribute error [closed]
Closed as off topic by Alexei on Mar 1, 2021 at 06:46
This question is not within the scope of Software Development.
This question was closed; new answers can no longer be added. Users with the reopen privilege may vote to reopen this question if it has been improved or closed incorrectly.
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 comment thread