Skip to content
Fix Code Error

How to change a string into uppercase

March 13, 2021 by Code Error
Posted By: Anonymous

I have problem in changing a string into uppercase with Python. In my research, I got string.ascii_uppercase but it doesn’t work.

The following code:

 >>s = 'sdsd'
 >>s.ascii_uppercase

Gives this error message:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: 'str' object has no attribute 'ascii_uppercase'

My question is: how can I convert a string into uppercase in Python?

Solution

>>> s = 'sdsd'
>>> s.upper()
'SDSD'

See String Methods.

Answered By: Anonymous

Related Articles

  • Usage of __slots__?
  • What's the difference between eval, exec, and compile?
  • How do you read a Python Traceback error?
  • Validate that a string is a positive integer
  • Can't install via pip because of egg_info error
  • problem with client server unix domain stream…
  • How to catch and print the full exception traceback…
  • render function or template not defined in…
  • How to check if a string contains text from an array…
  • Random string generation with upper case letters and digits
  • error LNK2005: ✘✘✘ already defined in…
  • What are the undocumented features and limitations…
  • 'int' object has no attribute 'user_list'. (Django…
  • Struggling to work out how to send an embedded…
  • Manually raising (throwing) an exception in Python
  • Python File Error: unpack requires a buffer of 16 bytes
  • Can't understand the difference between declaring a…
  • DJango doesn't execute request.method == "post" with…
  • How do I merge two dictionaries in a single…
  • Reversing a string in C
  • How can I wrap all BeautifulSoup existing…
  • How does String substring work in Swift
  • Relative imports for the billionth time
  • Convert multiple csv to another csv format
  • Selenium using Python - Geckodriver executable needs…
  • How to convert number to words in java
  • pip install mysql-python fails with…
  • Bootstrap - center child when parent isn't centered…
  • What are type hints in Python 3.5?
  • how to toggle class for multiple elements in vue js
  • i have this error what is the solve for it
  • I don't know why this python code for replacing all…
  • How to avoid "module not found" error while calling…
  • Image.open() cannot identify image file - Python?
  • TypeError: 'str' object is not callable (Python)
  • How to set HTML5 required attribute in Javascript?
  • Python: importing a sub‑package or sub‑module
  • What are the currently supported CSS selectors…
  • Understanding exception handling during tkinter mainloop
  • useEffect Error: Minified React error #321 (GTM…
  • How to use Rust nom to write a parser for this kind…
  • Change column type in pandas
  • Regex to match only uppercase "words" with some exceptions
  • Python Math - TypeError: 'NoneType' object is not…
  • How can you force the UI to update in the middle of…
  • Pandas create the new columns based on the distinct…
  • Polymer - databinding within window.addEventListener…
  • AttributeError: 'list' object has no attribute 'data_filter'
  • AttributeError: 'str' object has no attribute 'append'
  • How to save traceback / sys.exc_info() values in a variable?
  • Why am I getting AttributeError: Object has no attribute
  • Simple C example of doing an HTTP POST and consuming…
  • Django & VSCode: can't create super user
  • ValueError: invalid literal for int () with base 10
  • Build Polymer App with multiple elements using one…
  • What is your most productive shortcut with Vim?
  • How to solve Internal Server Error in Next.Js?
  • Python: AttributeError: '_io.TextIOWrapper' object…
  • Remote end closed connection without response
  • How not to get a repeated attribute of an object?
  • The definitive guide to form-based website authentication
  • Having issue with my automod system in disocrd.py
  • Importing Pandas gives error AttributeError: module…
  • Can't stratify output in a customized way
  • Generating a PNG with matplotlib when DISPLAY is undefined
  • TypeError: 'list' object is not callable in python
  • Bot will not log an automod event if user has…
  • Webpack command throws error: Cannot find module 'webpack'
  • discord.ext.commands.errors.CommandInvokeError:…
  • How to catch an AttributeError in Background through…
  • Pip - Fatal error in launcher: Unable to create…
  • selenium - chromedriver executable needs to be in PATH
  • Using Javascript's atob to decode base64 doesn't…
  • polymer paper-scroll-header-panel doesn't display
  • Using StringWriter for XML Serialization
  • Qt program with OpenGL + GLSL integration crashes…
  • How to add Typescript to a Nativescript-Vue project?
  • Smart way to truncate long strings
  • Assigning a variable NaN in python without numpy
  • C++ OpenGL stb_image.h errors
  • How to resolve "Could not find schema information…
  • django db ProgrammingError
  • Why are Python's 'private' methods not actually private?
  • pyenv install 3.x BUILD FAILED (Ubuntu 20.04 using…
  • What is and how to fix…
  • Is there a built-in function to print all the…
  • Cannot get post Ajax data in Laravel Resource Controller
  • TypeError: int() argument must be a string, a…
  • TypeError: 'tuple' object is not callable when…
  • How to fix symbol lookup error: undefined symbol…
  • Cosmos SQL db create item
  • What's the best way to set variables only if they…
  • PHP parse/syntax errors; and how to solve them
  • time convert to miliseconds bug
  • Convert Python ElementTree to string
  • How to remove the last character from a string?
  • TypeError: Cannot read property 'webpackJsonp' of undefined
  • VUE Error when run test unit
  • AppCompat v7 r21 returning error in values.xml?
  • Understanding PrimeFaces process/update and JSF…

Disclaimer: This content is shared under creative common license cc-by-sa 3.0. It is generated from StackExchange Website Network.

Post navigation

Previous Post:

Python integer incrementing with ++

Next Post:

What does do?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

.net ajax android angular arrays aurelia backbone.js bash c++ css dataframe ember-data ember.js excel git html ios java javascript jquery json laravel linux list mysql next.js node.js pandas php polymer polymer-1.0 python python-3.x r reactjs regex sql sql-server string svelte typescript vue-component vue.js vuejs2 vuetify.js

  • you shouldn’t need to use z-index
  • No column in target database, but getting “The schema update is terminating because data loss might occur”
  • Angular – expected call-signature: ‘changePassword’ to have a typedeftslint(typedef)
  • trying to implement NativeAdFactory imports deprecated method by default in flutter java project
  • What should I use to get an attribute out of my foreign table in Laravel?
© 2022 Fix Code Error