2021年1月25日星期一

AttributeError: 'function' object has no attribute 'strip'

I am trying to strip the white space from the platform.system value so I can compare it in some if/else logic. I am getting the error below. What am I missing?

line 9, in print(os_name.strip()) AttributeError: 'function' object has no attribute 'strip'

import platform    os_name = platform.system  os_name_strip = os_name.strip()    print('OS Name      :', os_name_strip)    if os_name == 'Windows':      print('we have an OS match')  else:      print('we do not have an OS match')  
https://stackoverflow.com/questions/65894930/attributeerror-function-object-has-no-attribute-strip January 26, 2021 at 09:59AM

没有评论:

发表评论