Cool, thanks. I heard SP is a bit safer, especially if you stick to the Jardins/Paulista Avenue area, but I've also heard the safety issue is a bit overblown.
SP is way safer (I spent a year there on exchange), in Rio at night you can sometimes hear the sound of machine gun fire coming from the hills (probably 'celebrations' but who knows). My dad is from Brazil and served as a marine in Rio, and it was pretty bad during his time there (quite a while ago now though). My aunt still lives there, and she took a stray bullet in the shoulder one time when a fight broke out between a gang trying to hold up a bus and an off duty cop taking a ride home. That said I haven't spent any significant time in Rio, and loads of tourists go there all the time, so as long as you stick to the tourist frequented areas and don't go waving around valuable stuff, you should be fine.
You can get in trouble anywhere in south america if you don't know what you're doing, the main thing is to not go around looking like a dumb tourist in places where tourists don't go. Several of my friends were mugged in SP (one multiple times, he would walk around ogling everything like he'd just landed on earth and probably was an instant target) but I never did, even though I went out walking around all the time at night. I was kickboxing at the time and didn't present as someone you could just take stuff from though, and being half brazilian I don't stand out as much.
As
@POB said there are tons of venues and nightlife locations in SP, and there are places to go any day of the week, but in the daytime it's just a busy industrial city (quite polluted and drab tbh) and can be kind of boring. If you like women with a more european lineage it's a good place (even more so down south in places like Florianopolis, which is definitely a place you should check out).
I'd say SP is the better place if you want to stay in a big dirty city, sleep all day and go clubbing at night, and you'll probably have less competition from other tourists too. Whereas Rio is a good place to party on the beach and enjoy the view, but it's relatively small and overfilled with tourists.
Florianopolis is a very nice place if you like a variety of beaches, cute girls and a pretty chill vibe.
Probably best to try them all out for a few days and see what you like. And recent events may have changed the dynamic too, so I suggest checking up on how things are now specifically.