Mauro from Italy wants to know how to get the attention of a person or a group of people whom he doesn’t know, in both formal and informal situations.
The simplest phrase to use is “excuse me” and this can be used with an individual or group and in most situations.
For example, if you want to ask directions from a stranger, you can say, “Excuse me, could you tell me where the university is?” If you are speaking to a group, whether you know them or not, you can say, “excuse me” or “excuse me, everyone.” If you are going to make an announcement to a group, you can say, “Excuse me, may I have your attention, please?” For instance, at the beginning of a play, you may say, “Excuse me, everyone. / Excuse me, may I have your attention, please? Would you all take your seats (sit down)?”
If you want to be very formal or you are speaking to a customer, you can use the terms “sir” for a man and “ma’am” (pronounced “mam”) for a woman; “miss” can be used for a girl or young woman. You can use “gentlemen” for a group of all men or “ladies” for a group of all women.
For example, if you’re waiting for a table in a restaurant, the hostess may say, “Ma’am, your table is ready now” or “Gentlemen, ladies, (or ladies and gentlemen) your table is ready now.” However, she is just as likely to say, “Excuse me, your table is ready now.” This would be perfectly acceptable.
So, using “excuse me” is a safe choice and considered polite in all of the situations I can think of.
I hope this is helpful.